File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
ui/src/components/Editor/ToolBars Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -110,12 +110,12 @@ const Image = ({ editorInstance }) => {
110110 return ;
111111 }
112112
113- // const startPos = editor.getCursor(''); codemirror 6
114113 const startPos = editor . getCursor ( ) ;
115114
116115 const endPos = { ...startPos , ch : startPos . ch + loadingText . length } ;
117116
118117 editor . replaceSelection ( loadingText ) ;
118+ editor . setReadOnly ( true ) ;
119119 const urls = await upload ( fileList ) . catch ( ( ex ) => {
120120 console . error ( 'upload file error: ' , ex ) ;
121121 } ) ;
@@ -131,9 +131,10 @@ const Image = ({ editorInstance }) => {
131131 if ( text . length ) {
132132 editor . replaceRange ( text . join ( '\n' ) , startPos , endPos ) ;
133133 } else {
134- // Clear loading text
135134 editor . replaceRange ( '' , startPos , endPos ) ;
136135 }
136+ editor . setReadOnly ( false ) ;
137+ editor . focus ( ) ;
137138 } ;
138139
139140 const paste = async ( event ) => {
@@ -155,6 +156,7 @@ const Image = ({ editorInstance }) => {
155156
156157 editor . replaceRange ( text . join ( '\n' ) , startPos , endPos ) ;
157158 editor . setReadOnly ( false ) ;
159+ editor . focus ( ) ;
158160
159161 return ;
160162 }
You can’t perform that action at this time.
0 commit comments