mediawiki-extensions-CodeMi.../resources/codemirror.mediawiki.autocomplete.js
bhsd f8a89ccf32 CodeMirror: fix toggle-related issues
The hook handlers and event listeners associated with `CodeMirror.prototype.initialize()` are now removed when CM is toggled off.

For 2017 Wikitext Editor, the focus is always set on the VE surface view.

Bug: T380840
Bug: T380983
Bug: T381358
Change-Id: Ib83f3d49c3d0496cb570f62e75f3fdc0d700be47
2024-12-04 13:23:48 +08:00

22 lines
497 B
JavaScript

const {
Extension,
autocompletion,
acceptCompletion,
keymap
} = require( 'ext.CodeMirror.v6.lib' );
/**
* CodeMirror extension providing
* autocompletion
* for the MediaWiki mode. This automatically applied when using {@link CodeMirrorModeMediaWiki}.
*
* @module CodeMirrorAutocomplete
* @type {Extension}
*/
const autocompleteExtension = [
autocompletion( { defaultKeymap: true } ),
keymap.of( [ { key: 'Tab', run: acceptCompletion } ] )
];
module.exports = autocompleteExtension;