Merge "CodeMirror: load colorblind theme when preference is set"

This commit is contained in:
jenkins-bot 2024-02-14 11:58:16 +00:00 committed by Gerrit Code Review
commit ec28e18016
3 changed files with 11 additions and 2 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -162,6 +162,15 @@ export default class CodeMirror {
parent: this.$textarea.parent()[ 0 ]
} );
// Add colorblind mode if preference is set.
// This currently is only to be used for the MediaWiki markup language.
if (
mw.user.options.get( 'usecodemirror-colorblind' ) &&
mw.config.get( 'wgPageContentModel' ) === 'wikitext'
) {
this.view.dom.classList.add( 'cm-mw-colorblind-colors' );
}
// Hide native textarea and sync CodeMirror contents upon submission.
this.$textarea.hide();
if ( this.$textarea[ 0 ].form ) {