File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed
components/CodemirrorEditor Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 1
1
<script setup>
2
- import { ref } from ' vue'
2
+ import { ref , toRaw } from ' vue'
3
3
import { useStore } from ' @/stores'
4
4
import { createTable } from ' @/utils'
5
5
6
6
const store = useStore ()
7
7
8
- const { formatContent , toggleShowInsertFormDialog } = store
8
+ const { toggleShowInsertFormDialog } = store
9
9
10
10
const rowNum = ref (3 )
11
11
const colNum = ref (3 )
@@ -24,12 +24,8 @@ function insertTable() {
24
24
cols: colNum .value ,
25
25
data: tableData .value ,
26
26
})
27
- store .editor .operation (() => {
28
- store .editor .replaceSelection (` \n ${ table} \n ` , ` end` )
29
- })
30
- store .editorRefresh ()
27
+ toRaw (store .editor ).replaceSelection (` \n ${ table} \n ` , ` end` )
31
28
resetVal ()
32
- formatContent ()
33
29
toggleShowInsertFormDialog ()
34
30
}
35
31
</script >
Original file line number Diff line number Diff line change 1
1
<script setup>
2
- import { onMounted , ref } from ' vue'
2
+ import { onMounted , ref , toRaw } from ' vue'
3
3
import { storeToRefs } from ' pinia'
4
4
import { ElMessage } from ' element-plus'
5
5
import CodeMirror from ' codemirror'
@@ -180,10 +180,10 @@ function uploaded(imageUrl) {
180
180
const cursor = editor .value .getCursor ()
181
181
const markdownImage = ` `
182
182
// 将 Markdown 形式的 URL 插入编辑框光标所在位置
183
- editor . value .replaceSelection (` \n ${ markdownImage} \n ` , cursor)
183
+ toRaw ( store . editor ) .replaceSelection (` \n ${ markdownImage} \n ` , cursor)
184
184
ElMessage .success (` 图片上传成功` )
185
- formatContent ()
186
- onEditorRefresh ()
185
+ // formatContent()
186
+ // onEditorRefresh()
187
187
}
188
188
function uploadImage (file , cb ) {
189
189
isImgLoading .value = true
You can’t perform that action at this time.
0 commit comments