From 1267d3354f9d5c6d3448d637677ccef90ff9b901 Mon Sep 17 00:00:00 2001 From: krassowski <5832902+krassowski@users.noreply.github.com> Date: Thu, 15 Aug 2024 16:21:55 +0100 Subject: [PATCH] Fix loading --- README.md | 4 ++-- content/demo.html | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 01e12e5..c627d2a 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ JupyterLite deployed as a static site to GitHub Pages, for demo purposes. ## Try it in your browser -➡️ https://quansight.github.io/jupyterlite-demo/ -➡️ https://quansight.github.io/jupyterlite-demo/files/demo.html +- https://quansight.github.io/jupyterlite-demo/ +- https://quansight.github.io/jupyterlite-demo/files/demo.html ## Requirements diff --git a/content/demo.html b/content/demo.html index d7584b7..b69dd89 100644 --- a/content/demo.html +++ b/content/demo.html @@ -30,6 +30,9 @@ .content { padding: 4px } + code[data-run] { + white-space: pre-wrap; + }
@@ -98,11 +101,14 @@ } cleanCode += line.substring(indent) + '\n'; } + codeEl.textContent = cleanCode; iframe.src = `https://quansight.github.io/jupyterlite-demo/repl/index.html?kernel=python&toolbar=1&code=${cleanCode}`; - iframe.document.head.appendChild(styleSheet); iframe.style.width = '100%'; iframe.style.height = '300px'; - codeEl.replaceWith(iframe); + iframe.onload = () => { + iframe.contentDocument.head.appendChild(styleSheet); + codeEl.replaceWith(iframe); + } }