1
1
<script setup lang="ts">
2
2
import { useEventListener , throttledWatch } from ' @vueuse/core'
3
3
import { computed , watch , ref , onMounted } from ' vue'
4
- import { activeElement , showEditor , editorWidth } from ' ../state'
4
+ import { activeElement , showEditor , editorWidth , isInputing } from ' ../state'
5
5
import { useCodeMirror } from ' ../setup/codemirror'
6
6
import { currentRoute , currentSlideId } from ' ../logic/nav'
7
7
import { useDynamicSlideInfo } from ' ../logic/note'
@@ -13,17 +13,16 @@ const dirty = ref(false)
13
13
const frontmatter = ref <any >({})
14
14
const contentInput = ref <HTMLTextAreaElement >()
15
15
const noteInput = ref <HTMLTextAreaElement >()
16
- const focused = ref (false )
17
16
18
17
const { info, update } = useDynamicSlideInfo (currentSlideId )
19
18
20
19
watch (
21
20
info ,
22
21
(v ) => {
23
- note .value = (v ?.note || ' ' ).trim ()
24
22
frontmatter .value = v ?.frontmatter || {}
25
23
26
- if (! focused .value ) {
24
+ if (! isInputing .value ) {
25
+ note .value = (v ?.note || ' ' ).trim ()
27
26
content .value = (v ?.content || ' ' ).trim ()
28
27
dirty .value = false
29
28
}
@@ -67,14 +66,9 @@ onMounted(() => {
67
66
{
68
67
mode: ' markdown' ,
69
68
lineWrapping: true ,
69
+ // @ts-ignore
70
70
highlightFormatting: true ,
71
71
fencedCodeBlockDefaultMode: ' javascript' ,
72
- onfocus() {
73
- focused .value = true
74
- },
75
- onblur() {
76
- focused .value = false
77
- },
78
72
},
79
73
)
80
74
@@ -90,14 +84,9 @@ onMounted(() => {
90
84
{
91
85
mode: ' markdown' ,
92
86
lineWrapping: true ,
87
+ // @ts-ignore
93
88
highlightFormatting: true ,
94
89
fencedCodeBlockDefaultMode: ' javascript' ,
95
- onfocus() {
96
- focused .value = true
97
- },
98
- onblur() {
99
- focused .value = false
100
- },
101
90
},
102
91
)
103
92
})
0 commit comments