Skip to content

Commit

Permalink
fix: edtior theme empty when localStroage is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
MR-Addict committed Sep 14, 2024
1 parent a084182 commit 37275ff
Show file tree
Hide file tree
Showing 6 changed files with 616 additions and 523 deletions.
2 changes: 1 addition & 1 deletion backend/assets/script.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const lang = replElement.getAttribute("data-lang");
const code = getCode(replElement.nextElementSibling);
const readonly = replElement.getAttribute("data-readonly") === "true";
let theme = mapTheme(localStorage.getItem("mdbook-theme") || "light");
let theme = mapTheme(localStorage.getItem("mdbook-theme") || document.querySelector(".theme.theme-selected")?.id);

const postmessage = (msg) => iframeElement.contentWindow.postMessage({ repl: msg }, "*");

Expand Down
4 changes: 2 additions & 2 deletions docs/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use-default-preprocessors = false
[output.html]
default-theme = "Light"
preferred-dark-theme = "Ayu"
curly-quotes = true
smart-punctuation = true
mathjax-support = true
copy-fonts = true
no-section-label = false
Expand Down Expand Up @@ -50,7 +50,7 @@ copy-js = true
command = "backend/target/release/mdbook-repl"

# iframe url, default is https://mr-addict.github.io/mdbook-repl/embed/
src = "https://mr-addict.github.io/mdbook-repl/embed/"
src = "http://localhost:5173/"

# python is disabled by default and loading is lazy
python.enable = true
Expand Down
Loading

0 comments on commit 37275ff

Please sign in to comment.