From 2d99b7a1467cef57c9b71e6c2dd9bbdea67331e3 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Wed, 11 Sep 2024 19:13:09 +0800 Subject: feat: Use Query Params to render maps --- src/editor.mjs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/editor.mjs b/src/editor.mjs index 9b245d8..beee35b 100644 --- a/src/editor.mjs +++ b/src/editor.mjs @@ -32,6 +32,7 @@ const getContentFromHash = (hash) => { } const initialState = getStateFromHash(window.location.hash) +const queryParams = new URL(window.location).searchParams window.location.hash = '' const contentFromHash = initialState.content const lastContent = localStorage.getItem('editorContent') @@ -82,6 +83,10 @@ const cm = editor.codemirror markdown2HTML(HtmlContainer, editor.value()) createDocLinks(HtmlContainer) +if (queryParams.get('render')) { + toggleMaps(HtmlContainer) +} + // Re-render HTML by editor content cm.on("change", () => { markdown2HTML(HtmlContainer, editor.value()) -- cgit v1.2.3-70-g09d2