feedback-vos 1.0.40 → 1.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/index.js +27 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -7
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +33 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -265,8 +265,21 @@ function ScreenshotEditor({
|
|
|
265
265
|
const editedScreenshot = canvas.toDataURL("image/png");
|
|
266
266
|
onSave(editedScreenshot);
|
|
267
267
|
};
|
|
268
|
-
const
|
|
269
|
-
|
|
268
|
+
const [maxDisplayWidth, setMaxDisplayWidth] = useState(600);
|
|
269
|
+
useEffect(() => {
|
|
270
|
+
const updateMaxWidth = () => {
|
|
271
|
+
if (window.innerWidth >= 768) {
|
|
272
|
+
const availableWidth = window.innerWidth * 0.9 - 64;
|
|
273
|
+
setMaxDisplayWidth(Math.max(1200, Math.min(availableWidth, 1600)));
|
|
274
|
+
} else {
|
|
275
|
+
setMaxDisplayWidth(600);
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
updateMaxWidth();
|
|
279
|
+
window.addEventListener("resize", updateMaxWidth);
|
|
280
|
+
return () => window.removeEventListener("resize", updateMaxWidth);
|
|
281
|
+
}, []);
|
|
282
|
+
const displayWidth = image ? Math.min(maxDisplayWidth, image.width) : maxDisplayWidth;
|
|
270
283
|
const displayHeight = image ? displayWidth / image.width * image.height : 400;
|
|
271
284
|
return /* @__PURE__ */ jsx("div", { className: `fixed inset-0 z-50 flex items-center justify-center ${themeClasses.overlay} p-2 md:p-4`, children: /* @__PURE__ */ jsxs("div", { className: `${themeClasses.bgSecondary} rounded-lg shadow-xl max-w-4xl w-full max-h-[95vh] md:max-h-[90vh] overflow-auto`, children: [
|
|
272
285
|
/* @__PURE__ */ jsxs("div", { className: `sticky top-0 ${themeClasses.bgSecondary} border-b ${themeClasses.borderPrimary} p-2 md:p-4 flex items-center justify-between z-10 gap-2`, children: [
|
|
@@ -381,23 +394,30 @@ function ScreenshotButton({
|
|
|
381
394
|
const themeClasses = getThemeClasses(theme);
|
|
382
395
|
async function handleTakeScreenshot() {
|
|
383
396
|
setIsTakenScreenShot(true);
|
|
384
|
-
const canvas = await html2canvas(document.
|
|
397
|
+
const canvas = await html2canvas(document.body, {
|
|
385
398
|
width: window.innerWidth,
|
|
386
399
|
height: window.innerHeight,
|
|
387
|
-
x: 0,
|
|
388
|
-
y: 0,
|
|
389
400
|
windowWidth: window.innerWidth,
|
|
390
401
|
windowHeight: window.innerHeight,
|
|
402
|
+
scrollX: -window.scrollX,
|
|
403
|
+
scrollY: -window.scrollY,
|
|
391
404
|
scale: 1,
|
|
392
405
|
// Use scale 1 for consistent sizing
|
|
393
406
|
useCORS: true,
|
|
407
|
+
allowTaint: true,
|
|
408
|
+
// Allow external images for better rendering
|
|
409
|
+
backgroundColor: null,
|
|
410
|
+
// Preserve page background
|
|
411
|
+
removeContainer: false,
|
|
412
|
+
// Maintain proper container rendering
|
|
394
413
|
logging: false,
|
|
395
414
|
ignoreElements: (element) => {
|
|
396
415
|
return element.hasAttribute("data-feedback-widget") || element.closest("[data-feedback-widget]") !== null;
|
|
397
416
|
}
|
|
398
417
|
});
|
|
399
|
-
const
|
|
400
|
-
const
|
|
418
|
+
const isMobile = window.innerWidth < 768;
|
|
419
|
+
const targetWidth = isMobile ? 1080 : 1920;
|
|
420
|
+
const targetHeight = isMobile ? 1920 : 1080;
|
|
401
421
|
const normalizedCanvas = document.createElement("canvas");
|
|
402
422
|
normalizedCanvas.width = targetWidth;
|
|
403
423
|
normalizedCanvas.height = targetHeight;
|