mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-23 13:56:44 +00:00
CodeMirror: make bracket matching match CJK full-width brackets
This is only done for wikitext because CJK brackets can cause unexpected errors in other languages. Bug: T362992 Change-Id: Icf98e8fd7e0392845df2e3b7d3201e7f94f95a3f
This commit is contained in:
parent
a21aa79e2d
commit
0e5fe342d9
2
resources/dist/codemirror.js
vendored
2
resources/dist/codemirror.js
vendored
File diff suppressed because one or more lines are too long
|
@ -82,7 +82,7 @@ class CodeMirror {
|
|||
this.specialCharsExtension,
|
||||
this.heightExtension,
|
||||
this.updateExtension,
|
||||
bracketMatching(),
|
||||
this.bracketMatchingExtension,
|
||||
EditorState.readOnly.of( this.readOnly ),
|
||||
EditorView.domEventHandlers( {
|
||||
blur: () => this.$textarea.triggerHandler( 'blur' ),
|
||||
|
@ -117,6 +117,21 @@ class CodeMirror {
|
|||
return extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* This extension adds bracket matching to the CodeMirror editor.
|
||||
*
|
||||
* @return {Extension}
|
||||
*/
|
||||
get bracketMatchingExtension() {
|
||||
return bracketMatching( mw.config.get( 'wgPageContentModel' ) === 'wikitext' ?
|
||||
{
|
||||
// Also match CJK full-width brackets (T362992)
|
||||
// This is only for wikitext as it can be confusing in programming languages.
|
||||
brackets: '()[]{}()【】[]{}'
|
||||
} : {}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This extension listens for changes in the CodeMirror editor and fires
|
||||
* the `ext.CodeMirror.input` hook with the {@link ViewUpdate} object.
|
||||
|
|
Loading…
Reference in a new issue