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