CodeMirrorWikiEditor: add extension for multiple selections/cursors

This was preexisting behaviour in CM5 as a rather hidden feature,
and this patch brings it to CM6 keeping it just as hidden. That is,
to have focus in the texatrea, hit Ctrl (or ⌘ on Mac) to insert multiple
cursors, and similarly multiple selections and change their content.

This doesn't actually fix the bug reported at T211205. That may not
even be fixable, since jQuery.textSelection is the interface used to
interact with editors, and it doesn't support multiple selections.

Bug: T211205
Change-Id: I9d4d634c2ba46b909543a0090b871cee4b183fa0
This commit is contained in:
MusikAnimal 2024-02-13 16:51:04 -05:00
parent ec28e18016
commit 46b458cc0c
4 changed files with 7 additions and 5 deletions

View file

@ -52,7 +52,7 @@
"bundlesize": [
{
"path": "resources/dist/main.js",
"maxSize": "100.0kB"
"maxSize": "105.0kB"
}
]
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
import CodeMirror from './codemirror';
import { EditorSelection } from '@codemirror/state';
import { EditorView, keymap } from '@codemirror/view';
import { EditorState, EditorSelection } from '@codemirror/state';
import { EditorView, drawSelection, keymap } from '@codemirror/view';
import { defaultKeymap, history, historyKeymap } from '@codemirror/commands';
import { searchKeymap } from '@codemirror/search';
import { bracketMatching } from '@codemirror/language';
@ -61,6 +61,8 @@ export default class CodeMirrorWikiEditor extends CodeMirror {
}
} ),
EditorView.lineWrapping,
EditorState.allowMultipleSelections.of( true ),
drawSelection(),
keymap.of( [
...defaultKeymap,
...searchKeymap,