mirror of
https://github.com/zadam/trilium.git
synced 2026-07-09 12:33:58 +02:00
add optional chaining to access window.parent in callback
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user