File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,13 @@ type GlobalState = {
88}
99
1010function placeCaretAtEnd ( el : HTMLInputElement ) {
11+ const currentSelection = window . getSelection ( )
12+ if ( currentSelection . containsNode ( el ) ) return
1113 el . focus ( )
12- let range = document . createRange ( )
14+ const range = document . createRange ( )
1315 range . selectNodeContents ( el )
1416 range . collapse ( false )
15- let sel = window . getSelection ( )
17+ const sel = window . getSelection ( )
1618 sel . removeAllRanges ( )
1719 sel . addRange ( range )
1820}
@@ -46,7 +48,7 @@ export const useContentEditableEffect = (engine: Engine) => {
4648 setTimeout ( ( ) => {
4749 placeCaretAtEnd ( this )
4850 } , 16 )
49- } , 1000 )
51+ } , 300 )
5052 }
5153 }
5254
Original file line number Diff line number Diff line change 243243 }
244244
245245 * [contenteditable= ' true' ] {
246- display : block !important ;
246+ display : block ;
247247 min-width : 1px ;
248- min-height : 14px !important ;
248+ min-height : 14px ;
249249 cursor : text !important ;
250250 outline : none !important ;
251251 }
You can’t perform that action at this time.
0 commit comments