mirror of
https://github.com/zadam/trilium.git
synced 2026-03-22 16:23:50 +01:00
add optional chaining to access window.parent in callback
This commit is contained in:
parent
940f7f77f5
commit
10e28789e2
@ -7,9 +7,9 @@ import { setupPdfLayers } from "./layers";
|
||||
async function main() {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const isEditable = urlParams.get("editable") === "1";
|
||||
|
||||
|
||||
document.body.classList.toggle("read-only-document", !isEditable);
|
||||
|
||||
|
||||
if (urlParams.get("sidebar") === "0") {
|
||||
hideSidebar();
|
||||
}
|
||||
@ -50,7 +50,7 @@ function configurePdfViewerOptions() {
|
||||
};
|
||||
if (window.parent && window.parent !== window) {
|
||||
window.parent.addEventListener("webviewerloaded", pdfOptionsHandler, { once: true });
|
||||
window.addEventListener("pagehide", () => window.parent.removeEventListener("webviewerloaded", pdfOptionsHandler));
|
||||
window.addEventListener("pagehide", () => window.parent?.removeEventListener("webviewerloaded", pdfOptionsHandler));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user