mirror of
https://github.com/logseq/logseq.git
synced 2026-04-27 15:45:00 +00:00
fix(ui): code block theme when toggling theme
This commit is contained in:
@@ -113,8 +113,9 @@
|
||||
(let [editor @editor-atom
|
||||
doc (.getDoc editor)
|
||||
code (nth (:rum/args state) 3)]
|
||||
(.setValue doc code))
|
||||
(let [[config id attr code] (:rum/args state)
|
||||
(.setValue doc code)
|
||||
@editor-atom)
|
||||
(let [[config id attr code theme] (:rum/args state)
|
||||
original-mode (get attr :data-lang)
|
||||
mode (or original-mode "javascript")
|
||||
clojure? (contains? #{"clojure" "clj" "text/x-clojure" "cljs" "cljc"} mode)
|
||||
@@ -127,7 +128,7 @@
|
||||
(when textarea
|
||||
(from-textarea textarea
|
||||
#js {:mode mode
|
||||
:theme (if dark? "solarized dark" "solarized")
|
||||
:theme (str "solarized " theme)
|
||||
:matchBrackets lisp?
|
||||
:autoCloseBrackets true
|
||||
:lineNumbers true
|
||||
@@ -171,9 +172,11 @@
|
||||
(load-and-render! state)
|
||||
state)
|
||||
:did-update (fn [state]
|
||||
(when-let [editor @(:editor-atom state)]
|
||||
(.setOption editor "theme" (str "solarized " (nth (state :rum/args) 4))))
|
||||
(load-and-render! state)
|
||||
state)}
|
||||
[state config id attr code options]
|
||||
[state config id attr code theme options]
|
||||
[:div.extensions__code
|
||||
[:div.extensions__code-lang
|
||||
(let [mode (string/lower-case (get attr :data-lang "javascript"))]
|
||||
|
||||
Reference in New Issue
Block a user