Skip to content

Commit c72df28

Browse files
committed
✨ chore: improve naming in watch
1 parent 7b28769 commit c72df28

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

components/midori/editor.vue

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ function saveCaretPosition(context) {
4242
}
4343
}
4444
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+
// }
6060
6161
function getTextNodeAtPosition(root, index) {
6262
const NODE_TYPE = NodeFilter.SHOW_TEXT
@@ -113,12 +113,12 @@ const execute = async () => {
113113
})
114114
}
115115
116-
watch(isDark, (isDark) => {
116+
watch(isDark, (value) => {
117117
const editor = document.querySelector<HTMLElement>('pre.elysia-editor');
118118
119119
editor.innerHTML = highlighter.codeToHtml(
120120
editor.innerText, {
121-
theme: isDark ? 'github-dark' : 'github-light',
121+
theme: value ? 'github-dark' : 'github-light',
122122
lang: 'javascript',
123123
})
124124
})

0 commit comments

Comments
 (0)