Skip to content

Commit

Permalink
Merge pull request #12 from JerryI/dev
Browse files Browse the repository at this point in the history
fix css injection
  • Loading branch information
JerryI authored Oct 20, 2024
2 parents 2cd0fd9 + 743357d commit ad8a811
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/FrontendRuntime.wl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
}
Expand Down

0 comments on commit ad8a811

Please sign in to comment.