@uxbertlabs/reportly 1.0.6 → 1.0.7
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.map +1 -1
- package/dist/reportly.cjs.js +46 -2
- package/dist/reportly.cjs.js.map +1 -1
- package/dist/reportly.esm.js +46 -2
- package/dist/reportly.esm.js.map +1 -1
- package/dist/reportly.js +46 -2
- 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.esm.js
CHANGED
@@ -9456,8 +9456,8 @@ class Screenshot {
|
|
9456
9456
|
if (mode === 'viewport') {
|
9457
9457
|
// Capture only the current viewport
|
9458
9458
|
canvas = await html2canvas(document.body, {
|
9459
|
-
allowTaint: true,
|
9460
9459
|
useCORS: true,
|
9460
|
+
allowTaint: false,
|
9461
9461
|
logging: false,
|
9462
9462
|
width: window.innerWidth,
|
9463
9463
|
height: window.innerHeight,
|
@@ -9465,6 +9465,28 @@ class Screenshot {
|
|
9465
9465
|
windowHeight: window.innerHeight,
|
9466
9466
|
x: window.scrollX,
|
9467
9467
|
y: window.scrollY,
|
9468
|
+
ignoreElements: (element) => {
|
9469
|
+
// Skip cross-origin images that might cause issues
|
9470
|
+
if (element.tagName === 'IMG') {
|
9471
|
+
const img = element;
|
9472
|
+
try {
|
9473
|
+
// Test if image is accessible
|
9474
|
+
const canvas = document.createElement('canvas');
|
9475
|
+
const ctx = canvas.getContext('2d');
|
9476
|
+
canvas.width = 1;
|
9477
|
+
canvas.height = 1;
|
9478
|
+
ctx?.drawImage(img, 0, 0, 1, 1);
|
9479
|
+
canvas.toDataURL(); // This will throw if tainted
|
9480
|
+
return false; // Include the image
|
9481
|
+
}
|
9482
|
+
catch (e) {
|
9483
|
+
// Image is tainted, skip it
|
9484
|
+
console.warn('Skipping cross-origin image:', img.src);
|
9485
|
+
return true;
|
9486
|
+
}
|
9487
|
+
}
|
9488
|
+
return false;
|
9489
|
+
},
|
9468
9490
|
});
|
9469
9491
|
}
|
9470
9492
|
else {
|
@@ -9475,11 +9497,33 @@ class Screenshot {
|
|
9475
9497
|
const fullPageWidth = Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);
|
9476
9498
|
// Capture the full page
|
9477
9499
|
canvas = await html2canvas(document.body, {
|
9478
|
-
allowTaint: true,
|
9479
9500
|
useCORS: true,
|
9501
|
+
allowTaint: false,
|
9480
9502
|
logging: false,
|
9481
9503
|
width: fullPageWidth,
|
9482
9504
|
height: fullPageHeight,
|
9505
|
+
ignoreElements: (element) => {
|
9506
|
+
// Skip cross-origin images that might cause issues
|
9507
|
+
if (element.tagName === 'IMG') {
|
9508
|
+
const img = element;
|
9509
|
+
try {
|
9510
|
+
// Test if image is accessible
|
9511
|
+
const canvas = document.createElement('canvas');
|
9512
|
+
const ctx = canvas.getContext('2d');
|
9513
|
+
canvas.width = 1;
|
9514
|
+
canvas.height = 1;
|
9515
|
+
ctx?.drawImage(img, 0, 0, 1, 1);
|
9516
|
+
canvas.toDataURL(); // This will throw if tainted
|
9517
|
+
return false; // Include the image
|
9518
|
+
}
|
9519
|
+
catch (e) {
|
9520
|
+
// Image is tainted, skip it
|
9521
|
+
console.warn('Skipping cross-origin image:', img.src);
|
9522
|
+
return true;
|
9523
|
+
}
|
9524
|
+
}
|
9525
|
+
return false;
|
9526
|
+
},
|
9483
9527
|
});
|
9484
9528
|
// Restore scroll position
|
9485
9529
|
window.scrollTo(0, originalScrollY);
|