File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -462,18 +462,14 @@ export default defineComponent({
462462
463463 // Range Fix ?
464464 // https://github.com/logue/vue-codemirror6/issues/27
465- if (
466- ! selection . value . ranges . every (
467- range => range . anchor < value . length && range . head < value . length
468- )
469- ) {
470- return ;
471- }
472-
465+ const isSelectionOutOfRange = ! view . value . state . selection . ranges . every (
466+ range => range . anchor < value . length && range . head < value . length
467+ )
468+
473469 // Update
474470 view . value . dispatch ( {
475471 changes : { from : 0 , to : view . value . state . doc . length , insert : value } ,
476- selection : view . value . state . selection ,
472+ selection : isSelectionOutOfRange ? { anchor : 0 , head : 0 } : view . value . state . selection ,
477473 scrollIntoView : true ,
478474 } ) ;
479475 } ,
You can’t perform that action at this time.
0 commit comments