releasebird-javascript-sdk 1.0.48 → 1.0.49
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.
|
@@ -110,6 +110,24 @@ export default class RbirdScreenshotManager {
|
|
|
110
110
|
|
|
111
111
|
// Use requestAnimationFrame to ensure the changes are applied before screenshot
|
|
112
112
|
requestAnimationFrame(() => {
|
|
113
|
+
// Temporarily disable external stylesheets to avoid CORS errors
|
|
114
|
+
const externalStylesheets = [];
|
|
115
|
+
const stylesheets = document.querySelectorAll('link[rel="stylesheet"]');
|
|
116
|
+
stylesheets.forEach((stylesheet) => {
|
|
117
|
+
const href = stylesheet.getAttribute('href');
|
|
118
|
+
// Check if it's an external stylesheet (different domain)
|
|
119
|
+
if (href && (href.startsWith('http://') || href.startsWith('https://')) &&
|
|
120
|
+
!href.includes(window.location.hostname)) {
|
|
121
|
+
externalStylesheets.push({
|
|
122
|
+
element: stylesheet,
|
|
123
|
+
disabled: stylesheet.disabled,
|
|
124
|
+
parent: stylesheet.parentNode
|
|
125
|
+
});
|
|
126
|
+
stylesheet.disabled = true;
|
|
127
|
+
console.log('[Screenshot] Temporarily disabling external stylesheet:', href);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
113
131
|
// Use html-to-image's toJpeg method with higher resolution
|
|
114
132
|
// Capture only the visible viewport
|
|
115
133
|
htmlToImage.toJpeg(document.body, {
|
|
@@ -157,6 +175,11 @@ export default class RbirdScreenshotManager {
|
|
|
157
175
|
});
|
|
158
176
|
}
|
|
159
177
|
}).then(function (dataUrl) {
|
|
178
|
+
// Re-enable external stylesheets
|
|
179
|
+
externalStylesheets.forEach(({element, disabled}) => {
|
|
180
|
+
element.disabled = disabled;
|
|
181
|
+
});
|
|
182
|
+
|
|
160
183
|
// Restore visibility
|
|
161
184
|
loader.style.visibility = 'visible';
|
|
162
185
|
if (closeButton) {
|
|
@@ -179,6 +202,10 @@ export default class RbirdScreenshotManager {
|
|
|
179
202
|
that.deactivateMarker();
|
|
180
203
|
|
|
181
204
|
}).catch((e) => {
|
|
205
|
+
// Re-enable external stylesheets on error
|
|
206
|
+
externalStylesheets.forEach(({element, disabled}) => {
|
|
207
|
+
element.disabled = disabled;
|
|
208
|
+
});
|
|
182
209
|
console.error('Screenshot error with toJpeg:', e);
|
|
183
210
|
|
|
184
211
|
// Try alternative method: toPng with more lenient options
|
|
@@ -238,6 +265,9 @@ export default class RbirdScreenshotManager {
|
|
|
238
265
|
});
|
|
239
266
|
}
|
|
240
267
|
}).then(function (dataUrl) {
|
|
268
|
+
// Re-enable external stylesheets (fallback success)
|
|
269
|
+
// Already re-enabled above, but ensure it's done
|
|
270
|
+
|
|
241
271
|
// Restore visibility
|
|
242
272
|
loader.style.visibility = 'visible';
|
|
243
273
|
if (closeButton) {
|
|
@@ -259,6 +289,9 @@ export default class RbirdScreenshotManager {
|
|
|
259
289
|
|
|
260
290
|
that.deactivateMarker();
|
|
261
291
|
}).catch((fallbackError) => {
|
|
292
|
+
// Re-enable external stylesheets (fallback error)
|
|
293
|
+
// Already re-enabled above, but ensure it's done
|
|
294
|
+
|
|
262
295
|
// Restore visibility on final error
|
|
263
296
|
loader.style.visibility = 'visible';
|
|
264
297
|
if (closeButton) {
|