mirror of
https://github.com/shrekbytes/advanced-pdf-export.git
synced 2026-07-22 07:25:03 +00:00
fix: cross-window CSSStyleSheet crash in preview/export
This commit is contained in:
parent
156a14ee9b
commit
57b1645e9f
3 changed files with 7 additions and 7 deletions
6
main.js
6
main.js
File diff suppressed because one or more lines are too long
|
|
@ -433,11 +433,11 @@ export class PDFExportModal extends Modal {
|
|||
|
||||
if (immediate) {
|
||||
// Double rAF: ensures the spinner paints before synchronous pagination blocks the thread.
|
||||
window.requestAnimationFrame(() => window.requestAnimationFrame(() => void safeDo()));
|
||||
activeWindow.requestAnimationFrame(() => activeWindow.requestAnimationFrame(() => void safeDo()));
|
||||
} else {
|
||||
this.renderDebounceTimer = window.setTimeout(() => {
|
||||
this.renderDebounceTimer = null;
|
||||
window.requestAnimationFrame(() => window.requestAnimationFrame(() => void safeDo()));
|
||||
activeWindow.requestAnimationFrame(() => activeWindow.requestAnimationFrame(() => void safeDo()));
|
||||
}, 150);
|
||||
}
|
||||
}
|
||||
|
|
@ -601,7 +601,7 @@ export class PDFExportModal extends Modal {
|
|||
.mpdf-hf-right { margin-left: auto; }
|
||||
${docCSS}
|
||||
`;
|
||||
const pageSheet = new CSSStyleSheet();
|
||||
const pageSheet = new (activeWindow as unknown as typeof window).CSSStyleSheet();
|
||||
pageSheet.replaceSync(shadowCSS);
|
||||
|
||||
for (const layout of layouts) {
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ export function paginateEl(
|
|||
|
||||
const sandboxShadow = sandboxHost.attachShadow({ mode: "open" });
|
||||
|
||||
const sandboxSheet = new CSSStyleSheet();
|
||||
const sandboxSheet = new (activeWindow as unknown as typeof window).CSSStyleSheet();
|
||||
sandboxSheet.replaceSync(docCSS);
|
||||
sandboxShadow.adoptedStyleSheets = [sandboxSheet];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue