feedback-vos 1.0.38 → 1.0.39
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/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -394,11 +394,17 @@ function ScreenshotButton({
|
|
|
394
394
|
scrollY: -window.scrollY,
|
|
395
395
|
windowWidth: window.innerWidth,
|
|
396
396
|
windowHeight: window.innerHeight,
|
|
397
|
+
scale: window.devicePixelRatio || 1,
|
|
398
|
+
// Use device pixel ratio for better quality
|
|
399
|
+
useCORS: true,
|
|
400
|
+
// Enable CORS for better image rendering
|
|
401
|
+
logging: false,
|
|
402
|
+
// Disable logging for cleaner output
|
|
397
403
|
ignoreElements: (element) => {
|
|
398
404
|
return element.hasAttribute("data-feedback-widget") || element.closest("[data-feedback-widget]") !== null;
|
|
399
405
|
}
|
|
400
406
|
});
|
|
401
|
-
const base64image = canvas.toDataURL("image/png");
|
|
407
|
+
const base64image = canvas.toDataURL("image/png", 1);
|
|
402
408
|
onScreenshotTook(base64image);
|
|
403
409
|
setIsTakenScreenShot(false);
|
|
404
410
|
}
|
|
@@ -748,7 +754,7 @@ async function uploadFileToRepo(token, owner, repo, file, folderPath, defaultBra
|
|
|
748
754
|
return rawUrl;
|
|
749
755
|
}
|
|
750
756
|
async function uploadScreenshotToRepo(token, owner, repo, screenshot, screenshotPath) {
|
|
751
|
-
const compressedScreenshot = await compressScreenshot(screenshot,
|
|
757
|
+
const compressedScreenshot = await compressScreenshot(screenshot, 2560, 0.9);
|
|
752
758
|
const base64Content = compressedScreenshot.includes(",") ? compressedScreenshot.split(",")[1] : compressedScreenshot;
|
|
753
759
|
const repoResponse = await fetch(
|
|
754
760
|
`https://api.github.com/repos/${owner}/${repo}`,
|
|
@@ -850,7 +856,7 @@ async function uploadScreenshotToRepo(token, owner, repo, screenshot, screenshot
|
|
|
850
856
|
console.log(`Screenshot uploaded successfully to: ${rawUrl}`);
|
|
851
857
|
return rawUrl;
|
|
852
858
|
}
|
|
853
|
-
function compressScreenshot(dataUrl, maxWidth =
|
|
859
|
+
function compressScreenshot(dataUrl, maxWidth = 2560, quality = 0.9) {
|
|
854
860
|
return new Promise((resolve, reject) => {
|
|
855
861
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
856
862
|
reject(new Error("Screenshot compression only works in browser environments"));
|
|
@@ -865,13 +871,17 @@ function compressScreenshot(dataUrl, maxWidth = 1920, quality = 0.7) {
|
|
|
865
871
|
height = height * maxWidth / width;
|
|
866
872
|
width = maxWidth;
|
|
867
873
|
}
|
|
868
|
-
|
|
869
|
-
canvas.
|
|
874
|
+
const dpr = window.devicePixelRatio || 1;
|
|
875
|
+
canvas.width = width * dpr;
|
|
876
|
+
canvas.height = height * dpr;
|
|
870
877
|
const ctx = canvas.getContext("2d");
|
|
871
878
|
if (!ctx) {
|
|
872
879
|
reject(new Error("Could not get canvas context"));
|
|
873
880
|
return;
|
|
874
881
|
}
|
|
882
|
+
ctx.imageSmoothingEnabled = true;
|
|
883
|
+
ctx.imageSmoothingQuality = "high";
|
|
884
|
+
ctx.scale(dpr, dpr);
|
|
875
885
|
ctx.drawImage(img, 0, 0, width, height);
|
|
876
886
|
const compressedDataUrl = canvas.toDataURL("image/jpeg", quality);
|
|
877
887
|
resolve(compressedDataUrl);
|