File tree 1 file changed +4
-2
lines changed
ui/src/components/Editor/ToolBars
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -110,12 +110,12 @@ const Image = ({ editorInstance }) => {
110
110
return ;
111
111
}
112
112
113
- // const startPos = editor.getCursor(''); codemirror 6
114
113
const startPos = editor . getCursor ( ) ;
115
114
116
115
const endPos = { ...startPos , ch : startPos . ch + loadingText . length } ;
117
116
118
117
editor . replaceSelection ( loadingText ) ;
118
+ editor . setReadOnly ( true ) ;
119
119
const urls = await upload ( fileList ) . catch ( ( ex ) => {
120
120
console . error ( 'upload file error: ' , ex ) ;
121
121
} ) ;
@@ -131,9 +131,10 @@ const Image = ({ editorInstance }) => {
131
131
if ( text . length ) {
132
132
editor . replaceRange ( text . join ( '\n' ) , startPos , endPos ) ;
133
133
} else {
134
- // Clear loading text
135
134
editor . replaceRange ( '' , startPos , endPos ) ;
136
135
}
136
+ editor . setReadOnly ( false ) ;
137
+ editor . focus ( ) ;
137
138
} ;
138
139
139
140
const paste = async ( event ) => {
@@ -155,6 +156,7 @@ const Image = ({ editorInstance }) => {
155
156
156
157
editor . replaceRange ( text . join ( '\n' ) , startPos , endPos ) ;
157
158
editor . setReadOnly ( false ) ;
159
+ editor . focus ( ) ;
158
160
159
161
return ;
160
162
}
You can’t perform that action at this time.
0 commit comments