From bab0f4e34285b35710d11e0db49079ac1be8805b Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Wed, 11 Dec 2024 16:32:04 +0100 Subject: [PATCH] Fix handling of IFrame src (#31) * Fix handling of IFrame src * simplify --- demo/src/main.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/demo/src/main.js b/demo/src/main.js index 475ff48..1205868 100644 --- a/demo/src/main.js +++ b/demo/src/main.js @@ -121,14 +121,11 @@ const modeRadios = document.querySelectorAll('input[name="mode"]'); modeRadios.forEach(radio => { radio.addEventListener('change', e => { const isNotebookView = e.target.value === 'notebook'; - const currentUrl = new URL(iframe.src); + let currentUrl = new URL(iframe.src); const isLite = currentUrl.pathname.includes('lite'); if (isLite) { - currentUrl.pathname = isNotebookView - ? '/lite/notebooks/index.html' - : '/lite/lab'; - currentUrl.search = isNotebookView ? '?path=example.ipynb' : ''; + currentUrl = `./lite/${isNotebookView ? 'notebooks/index.html?path=example.ipynb' : 'lab'}`; } else { currentUrl.pathname = isNotebookView ? '/notebooks/example.ipynb'