@@ -42,21 +42,21 @@ function saveCaretPosition(context) {
42
42
}
43
43
}
44
44
45
- function nextCaretPosition(context ) {
46
- const selection = window .getSelection ()
47
- const range = selection .getRangeAt (0 )
48
- range .setStart (context , 0 )
49
- const len = range .toString ().length
50
-
51
- return function restore() {
52
- const pos = getTextNodeAtPosition (context , len )
53
- selection .removeAllRanges ()
54
-
55
- const range = new Range ()
56
- range .setStart (pos .node , pos .position )
57
- selection .addRange (range )
58
- }
59
- }
45
+ // function nextCaretPosition(context) {
46
+ // const selection = window.getSelection()
47
+ // const range = selection.getRangeAt(0)
48
+ // range.setStart(context, 0)
49
+ // const len = range.toString().length
50
+
51
+ // return function restore() {
52
+ // const pos = getTextNodeAtPosition(context, len)
53
+ // selection.removeAllRanges()
54
+
55
+ // const range = new Range()
56
+ // range.setStart(pos.node, pos.position)
57
+ // selection.addRange(range)
58
+ // }
59
+ // }
60
60
61
61
function getTextNodeAtPosition(root , index ) {
62
62
const NODE_TYPE = NodeFilter .SHOW_TEXT
@@ -113,12 +113,12 @@ const execute = async () => {
113
113
})
114
114
}
115
115
116
- watch (isDark , (isDark ) => {
116
+ watch (isDark , (value ) => {
117
117
const editor = document .querySelector <HTMLElement >(' pre.elysia-editor' );
118
118
119
119
editor .innerHTML = highlighter .codeToHtml (
120
120
editor .innerText , {
121
- theme: isDark ? ' github-dark' : ' github-light' ,
121
+ theme: value ? ' github-dark' : ' github-light' ,
122
122
lang: ' javascript' ,
123
123
})
124
124
})
0 commit comments