Skip to content

Commit 11a48c9

Browse files
mknextjournal-ci
authored andcommitted
Upgrade CodeMirror 6 to 0.18
* Upgrade CodeMirror 6 to 0.18
1 parent ba97fd3 commit 11a48c9

File tree

4 files changed

+197
-185
lines changed

4 files changed

+197
-185
lines changed

demo/src/nextjournal/clojure_mode/demo.cljs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@
2626

2727
(def theme
2828
(.theme EditorView
29-
(j/lit {:$content {:white-space "pre-wrap"
30-
:padding "10px 0"}
31-
:$$focused {:outline "none"}
32-
:$line {:padding "0 9px"
33-
:line-height "1.6"
34-
:font-size "16px"
35-
:font-family "var(--code-font)"}
36-
:$matchingBracket {:border-bottom "1px solid var(--teal-color)"
37-
:color "inherit"}
38-
:$gutters {:background "transparent"
39-
:border "none"}
40-
:$gutterElement {:margin-left "5px"}
29+
(j/lit {".cm-content" {:white-space "pre-wrap"
30+
:padding "10px 0"}
31+
"&.cm-focused" {:outline "none"}
32+
".cm-line" {:padding "0 9px"
33+
:line-height "1.6"
34+
:font-size "16px"
35+
:font-family "var(--code-font)"}
36+
".cm-matchingBracket" {:border-bottom "1px solid var(--teal-color)"
37+
:color "inherit"}
38+
".cm-gutters" {:background "transparent"
39+
:border "none"}
40+
".cm-gutterElement" {:margin-left "5px"}
4141
;; only show cursor when focused
42-
:$cursor {:visibility "hidden"}
43-
"$$focused $cursor" {:visibility "visible"}})))
42+
".cm-cursor" {:visibility "hidden"}
43+
"&.cm-focused .cm-cursor" {:visibility "visible"}})))
4444

4545
(defonce extensions #js[theme
4646
(history)

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"dependencies": {
3-
"@codemirror/autocomplete": "^0.17.0",
4-
"@codemirror/closebrackets": "^0.17.0",
5-
"@codemirror/commands": "^0.17.0",
6-
"@codemirror/comment": "^0.17.0",
7-
"@codemirror/fold": "^0.17.0",
8-
"@codemirror/gutter": "^0.17.0",
9-
"@codemirror/highlight": "^0.17.0",
10-
"@codemirror/history": "^0.17.0",
11-
"@codemirror/language": "^0.17.0",
12-
"@codemirror/lint": "^0.17.0",
13-
"@codemirror/matchbrackets": "^0.17.0",
14-
"@codemirror/rectangular-selection": "^0.17.0",
15-
"@codemirror/search": "^0.17.0",
16-
"@codemirror/state": "^0.17.0",
17-
"@codemirror/view": "^0.17.0",
3+
"@codemirror/autocomplete": "^0.18.0",
4+
"@codemirror/closebrackets": "^0.18.0",
5+
"@codemirror/commands": "^0.18.0",
6+
"@codemirror/comment": "^0.18.0",
7+
"@codemirror/fold": "^0.18.0",
8+
"@codemirror/gutter": "^0.18.0",
9+
"@codemirror/highlight": "^0.18.3",
10+
"@codemirror/history": "^0.18.0",
11+
"@codemirror/language": "^0.18.0",
12+
"@codemirror/lint": "^0.18.0",
13+
"@codemirror/matchbrackets": "^0.18.0",
14+
"@codemirror/rectangular-selection": "^0.18.0",
15+
"@codemirror/search": "^0.18.0",
16+
"@codemirror/state": "^0.18.0",
17+
"@codemirror/view": "^0.18.0",
1818
"lezer": "^0.13.1",
1919
"lezer-clojure": "0.1.10",
2020
"lezer-generator": "^0.13.0",

src/nextjournal/clojure_mode/extensions/match_brackets.cljs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
["@codemirror/state" :refer [EditorState
44
StateField
55
Extension]]
6-
["@codemirror/view" :refer [EditorView themeClass
6+
["@codemirror/view" :refer [EditorView
77
Decoration DecorationSet]]
88
[applied-science.js-interop :as j]
99
[nextjournal.clojure-mode.node :as n]
@@ -15,8 +15,8 @@
1515
:$nonmatchingBracket {:color "#a22"}})
1616
(.baseTheme EditorView)))
1717

18-
(def ^js matching-mark (.mark Decoration (j/obj :class (themeClass "matchingBracket"))))
19-
(def ^js nonmatching-mark (.mark Decoration (j/obj :class (themeClass "nonmatchingBracket"))))
18+
(def ^js matching-mark (.mark Decoration (j/obj :class "cm-matchingBracket")))
19+
(def ^js nonmatching-mark (.mark Decoration (j/obj :class "cm-nonmatchingBracket")))
2020

2121
(defn mark-node [node ^js mark]
2222
(.range mark (n/start node) (n/end node)))

0 commit comments

Comments
 (0)