From 743357db8973aa0223d7b95b39a3438780d680d9 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Sat, 19 Oct 2024 11:34:51 +0200 Subject: [PATCH] fix css injection --- src/FrontendRuntime.wl | 4 ++++ src/misc.js | 1 + 2 files changed, 5 insertions(+) diff --git a/src/FrontendRuntime.wl b/src/FrontendRuntime.wl index 549089c..f48201b 100644 --- a/src/FrontendRuntime.wl +++ b/src/FrontendRuntime.wl @@ -36,6 +36,10 @@ injectInRuntime[{"Modules", "js"}, data_List] := With[{notebooks = Values[Notebo WebUISubmit[ Global`UIHeadInject["js", data ], #["Socket"] ] &/@ notebooks; ] +injectInRuntime[{"Modules", "css"}, data_List] := With[{notebooks = Values[Notebook`HashMap]}, + WebUISubmit[ Global`UIHeadInject["css", data ], #["Socket"] ] &/@ notebooks; +] + EventHandler[NotebookEditorChannel // EventClone, { "RequestRuntimeExtensions" -> Function[assoc, diff --git a/src/misc.js b/src/misc.js index 7a7a8cf..8353712 100644 --- a/src/misc.js +++ b/src/misc.js @@ -89,6 +89,7 @@ core.UIHeadInject.css = async (args, env) => { data.forEach((el) => { const style = document.createElement('style'); style.textContent = el; + console.log(el); document.head.appendChild(style); }) }