@uxbertlabs/reportly 1.0.6 → 1.0.8
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/features/screenshot.d.ts +1 -1
- package/dist/features/screenshot.d.ts.map +1 -1
- package/dist/reportly.cjs.js +51 -5
- package/dist/reportly.cjs.js.map +1 -1
- package/dist/reportly.esm.js +51 -5
- package/dist/reportly.esm.js.map +1 -1
- package/dist/reportly.js +51 -5
- package/dist/reportly.js.map +1 -1
- package/dist/reportly.min.js +1 -1
- package/dist/reportly.min.js.map +1 -1
- package/package.json +1 -1
package/dist/reportly.js
CHANGED
@@ -9450,24 +9450,48 @@ var Reportly = (function () {
|
|
9450
9450
|
constructor() {
|
9451
9451
|
this.currentScreenshot = null;
|
9452
9452
|
}
|
9453
|
-
async capture(mode =
|
9453
|
+
async capture(mode = "fullpage") {
|
9454
9454
|
try {
|
9455
9455
|
// Hide UXbert UI elements before capturing
|
9456
9456
|
this.hideUXbertElements();
|
9457
9457
|
const originalScrollY = window.scrollY;
|
9458
9458
|
let canvas;
|
9459
|
-
if (mode ===
|
9459
|
+
if (mode === "viewport") {
|
9460
9460
|
// Capture only the current viewport
|
9461
9461
|
canvas = await html2canvas(document.body, {
|
9462
|
-
|
9462
|
+
// foreignObjectRendering: true,
|
9463
|
+
imageTimeout: 40000,
|
9463
9464
|
useCORS: true,
|
9464
|
-
|
9465
|
+
allowTaint: false,
|
9466
|
+
logging: true,
|
9465
9467
|
width: window.innerWidth,
|
9466
9468
|
height: window.innerHeight,
|
9467
9469
|
windowWidth: window.innerWidth,
|
9468
9470
|
windowHeight: window.innerHeight,
|
9469
9471
|
x: window.scrollX,
|
9470
9472
|
y: window.scrollY,
|
9473
|
+
ignoreElements: (element) => {
|
9474
|
+
// Skip cross-origin images that might cause issues
|
9475
|
+
if (element.tagName === "IMG") {
|
9476
|
+
const img = element;
|
9477
|
+
try {
|
9478
|
+
// Test if image is accessible
|
9479
|
+
const canvas = document.createElement("canvas");
|
9480
|
+
const ctx = canvas.getContext("2d");
|
9481
|
+
canvas.width = 1;
|
9482
|
+
canvas.height = 1;
|
9483
|
+
ctx?.drawImage(img, 0, 0, 1, 1);
|
9484
|
+
canvas.toDataURL(); // This will throw if tainted
|
9485
|
+
return false; // Include the image
|
9486
|
+
}
|
9487
|
+
catch (e) {
|
9488
|
+
// Image is tainted, skip it
|
9489
|
+
console.warn("Skipping cross-origin image:", img.src);
|
9490
|
+
return true;
|
9491
|
+
}
|
9492
|
+
}
|
9493
|
+
return false;
|
9494
|
+
},
|
9471
9495
|
});
|
9472
9496
|
}
|
9473
9497
|
else {
|
@@ -9478,11 +9502,33 @@ var Reportly = (function () {
|
|
9478
9502
|
const fullPageWidth = Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);
|
9479
9503
|
// Capture the full page
|
9480
9504
|
canvas = await html2canvas(document.body, {
|
9481
|
-
allowTaint: true,
|
9482
9505
|
useCORS: true,
|
9506
|
+
allowTaint: false,
|
9483
9507
|
logging: false,
|
9484
9508
|
width: fullPageWidth,
|
9485
9509
|
height: fullPageHeight,
|
9510
|
+
ignoreElements: (element) => {
|
9511
|
+
// Skip cross-origin images that might cause issues
|
9512
|
+
if (element.tagName === "IMG") {
|
9513
|
+
const img = element;
|
9514
|
+
try {
|
9515
|
+
// Test if image is accessible
|
9516
|
+
const canvas = document.createElement("canvas");
|
9517
|
+
const ctx = canvas.getContext("2d");
|
9518
|
+
canvas.width = 1;
|
9519
|
+
canvas.height = 1;
|
9520
|
+
ctx?.drawImage(img, 0, 0, 1, 1);
|
9521
|
+
canvas.toDataURL(); // This will throw if tainted
|
9522
|
+
return false; // Include the image
|
9523
|
+
}
|
9524
|
+
catch (e) {
|
9525
|
+
// Image is tainted, skip it
|
9526
|
+
console.warn("Skipping cross-origin image:", img.src);
|
9527
|
+
return true;
|
9528
|
+
}
|
9529
|
+
}
|
9530
|
+
return false;
|
9531
|
+
},
|
9486
9532
|
});
|
9487
9533
|
// Restore scroll position
|
9488
9534
|
window.scrollTo(0, originalScrollY);
|