feat(client/print): print presentations with waiting for slides to load

This commit is contained in:
Elian Doran
2025-10-19 16:27:13 +03:00
parent 89dac52f49
commit 64576458b7
7 changed files with 58 additions and 10 deletions

View File

@@ -297,8 +297,19 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
return;
}
// Trigger in timeout to dismiss the menu while printing.
setTimeout(window.print, 0);
const iframe = document.createElement('iframe');
iframe.src = `?print#${this.notePath}`;
iframe.className = "print-iframe";
document.body.appendChild(iframe);
iframe.onload = () => {
console.log("Got ", iframe, iframe.contentWindow);
if (iframe.contentWindow) {
iframe.contentWindow.addEventListener("note-ready", () => {
iframe.contentWindow?.print();
document.body.removeChild(iframe);
});
}
};
}
async exportAsPdfEvent() {