From 6892756397d0f55def16d2e6e6c4d86a7e8851aa Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Tue, 10 Oct 2023 09:38:06 +0200 Subject: [PATCH] Ignore casing in wiki link marking --- web/cm_plugins/wiki_link.ts | 4 ++-- web/components/widget_sandbox_iframe.ts | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/web/cm_plugins/wiki_link.ts b/web/cm_plugins/wiki_link.ts index 0999870e..0c5fcf87 100644 --- a/web/cm_plugins/wiki_link.ts +++ b/web/cm_plugins/wiki_link.ts @@ -35,9 +35,9 @@ export function cleanWikiLinkPlugin(editor: Client) { cleanPage = page.split("@")[0]; } cleanPage = resolvePath(editor.currentPage!, cleanPage); - // console.log("Resolved page", resolvedPage); + const lowerCasePageName = cleanPage.toLowerCase(); for (const pageMeta of allPages) { - if (pageMeta.name === cleanPage) { + if (pageMeta.name.toLowerCase() === lowerCasePageName) { pageExists = true; break; } diff --git a/web/components/widget_sandbox_iframe.ts b/web/components/widget_sandbox_iframe.ts index 08077f57..4d5b5b2b 100644 --- a/web/components/widget_sandbox_iframe.ts +++ b/web/components/widget_sandbox_iframe.ts @@ -68,13 +68,16 @@ export function createWidgetSandboxIFrame( iframe.onload = () => { iframe.contentDocument!.write(panelHtml); - // return; // Subscribe to message event on global object (to receive messages from iframe) globalThis.addEventListener("message", messageListener); // Only run this code once iframe.onload = null; Promise.resolve(content).then((content) => { + if (!iframe.contentWindow) { + console.warn("Iframe went away or content was not loaded"); + return; + } if (content.html) { iframe.contentWindow!.postMessage({ type: "html",