@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
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/features/screenshot.ts"],"names":[],"mappings":"AAGA,cAAM,UAAU;IACd,OAAO,CAAC,iBAAiB,CAAgB;;IAMnC,OAAO,CAAC,IAAI,GAAE,UAAU,GAAG,UAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/features/screenshot.ts"],"names":[],"mappings":"AAGA,cAAM,UAAU;IACd,OAAO,CAAC,iBAAiB,CAAgB;;IAMnC,OAAO,CAAC,IAAI,GAAE,UAAU,GAAG,UAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;IA8G1E,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,kBAAkB;IAY1B,aAAa,IAAI,MAAM,GAAG,IAAI;IAI9B,KAAK,IAAI,IAAI;CAGd;AAED,eAAe,UAAU,CAAC"}
|
package/dist/reportly.cjs.js
CHANGED
@@ -9458,8 +9458,8 @@ class Screenshot {
|
|
9458
9458
|
if (mode === 'viewport') {
|
9459
9459
|
// Capture only the current viewport
|
9460
9460
|
canvas = await html2canvas(document.body, {
|
9461
|
-
allowTaint: true,
|
9462
9461
|
useCORS: true,
|
9462
|
+
allowTaint: false,
|
9463
9463
|
logging: false,
|
9464
9464
|
width: window.innerWidth,
|
9465
9465
|
height: window.innerHeight,
|
@@ -9467,6 +9467,28 @@ class Screenshot {
|
|
9467
9467
|
windowHeight: window.innerHeight,
|
9468
9468
|
x: window.scrollX,
|
9469
9469
|
y: window.scrollY,
|
9470
|
+
ignoreElements: (element) => {
|
9471
|
+
// Skip cross-origin images that might cause issues
|
9472
|
+
if (element.tagName === 'IMG') {
|
9473
|
+
const img = element;
|
9474
|
+
try {
|
9475
|
+
// Test if image is accessible
|
9476
|
+
const canvas = document.createElement('canvas');
|
9477
|
+
const ctx = canvas.getContext('2d');
|
9478
|
+
canvas.width = 1;
|
9479
|
+
canvas.height = 1;
|
9480
|
+
ctx?.drawImage(img, 0, 0, 1, 1);
|
9481
|
+
canvas.toDataURL(); // This will throw if tainted
|
9482
|
+
return false; // Include the image
|
9483
|
+
}
|
9484
|
+
catch (e) {
|
9485
|
+
// Image is tainted, skip it
|
9486
|
+
console.warn('Skipping cross-origin image:', img.src);
|
9487
|
+
return true;
|
9488
|
+
}
|
9489
|
+
}
|
9490
|
+
return false;
|
9491
|
+
},
|
9470
9492
|
});
|
9471
9493
|
}
|
9472
9494
|
else {
|
@@ -9477,11 +9499,33 @@ class Screenshot {
|
|
9477
9499
|
const fullPageWidth = Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);
|
9478
9500
|
// Capture the full page
|
9479
9501
|
canvas = await html2canvas(document.body, {
|
9480
|
-
allowTaint: true,
|
9481
9502
|
useCORS: true,
|
9503
|
+
allowTaint: false,
|
9482
9504
|
logging: false,
|
9483
9505
|
width: fullPageWidth,
|
9484
9506
|
height: fullPageHeight,
|
9507
|
+
ignoreElements: (element) => {
|
9508
|
+
// Skip cross-origin images that might cause issues
|
9509
|
+
if (element.tagName === 'IMG') {
|
9510
|
+
const img = element;
|
9511
|
+
try {
|
9512
|
+
// Test if image is accessible
|
9513
|
+
const canvas = document.createElement('canvas');
|
9514
|
+
const ctx = canvas.getContext('2d');
|
9515
|
+
canvas.width = 1;
|
9516
|
+
canvas.height = 1;
|
9517
|
+
ctx?.drawImage(img, 0, 0, 1, 1);
|
9518
|
+
canvas.toDataURL(); // This will throw if tainted
|
9519
|
+
return false; // Include the image
|
9520
|
+
}
|
9521
|
+
catch (e) {
|
9522
|
+
// Image is tainted, skip it
|
9523
|
+
console.warn('Skipping cross-origin image:', img.src);
|
9524
|
+
return true;
|
9525
|
+
}
|
9526
|
+
}
|
9527
|
+
return false;
|
9528
|
+
},
|
9485
9529
|
});
|
9486
9530
|
// Restore scroll position
|
9487
9531
|
window.scrollTo(0, originalScrollY);
|