Skip to content

Commit

Permalink
Fix handling of IFrame src (#31)
Browse files Browse the repository at this point in the history
* Fix handling of IFrame src

* simplify
  • Loading branch information
jtpio authored Dec 11, 2024
1 parent 782b8be commit bab0f4e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions demo/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit bab0f4e

Please sign in to comment.