Commit 7f535e4 1 parent d49db5f commit 7f535e4 Copy full SHA for 7f535e4
File tree 1 file changed +7
-11
lines changed
1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ const customInsertOpen = ref(false);
42
42
const customInsertSchema = ref <Schema >(joeProgress );
43
43
let lastSelectionRange: Range | undefined = undefined ;
44
44
// Image Upload
45
- let imageUploadCursor: Range | undefined ;
46
45
const imageUploadLock = false ;
47
46
let allowImageUpload: string [] = [];
48
47
// Debug
@@ -189,8 +188,6 @@ onMounted(async () => {
189
188
vditor .value .tip (" 当前已经存在正在上传的文件,请等待上传完成" , 2000 );
190
189
return ;
191
190
}
192
- // Save cursor
193
- imageUploadCursor = getCursor ();
194
191
// Check extension name
195
192
const extendName = files [0 ].name
196
193
.slice (files [0 ].name .lastIndexOf (" ." ) + 1 )
@@ -201,21 +198,20 @@ onMounted(async () => {
201
198
}
202
199
// Upload
203
200
if (props .uploadImage ) {
201
+ vditor .value .disabled ();
204
202
vditor .value .tip (" 正在上传图片..." , 2000 );
205
203
props .uploadImage (files [0 ]).then ((res : Attachment ) => {
206
- if (! res .status ) return ;
207
- vditor .value .disabled ();
208
- // Move cursor
209
- const tmpCursor = getCursor ();
210
- setCursor (imageUploadCursor );
211
- imageUploadCursor = undefined ;
212
- // Insert
204
+ if (! res .status ) {
205
+ vditor .value .enable ();
206
+ return ;
207
+ }
208
+ // Insert Image
213
209
vditor .value .insertValue (
214
210
` \n\n \n\n `
215
211
);
216
212
// Restore cursor
217
- setCursor (tmpCursor );
218
213
vditor .value .enable ();
214
+ vditor .value .focus ();
219
215
});
220
216
}
221
217
return null ;
You can’t perform that action at this time.
0 commit comments