mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-09-24 18:58:22 +00:00
Expect that deprecated mediawiki.toolbar may not be available
Bug: T177098 Change-Id: Icaf51c234981b4572362a0d76bf0b4b6653f3854
This commit is contained in:
parent
e3f0df1cfc
commit
9df6ec9df8
|
@ -1,11 +1,22 @@
|
|||
( function ( mw, $ ) {
|
||||
var origTextSelection, useCodeMirror, codeMirror, api, originHooksTextarea,
|
||||
wikiEditorToolbarEnabled, enableContentEditable = true, textBox;
|
||||
wikiEditorToolbarEnabled, textBox,
|
||||
enableContentEditable = true;
|
||||
|
||||
if ( mw.config.get( 'wgCodeEditorCurrentLanguage' ) ) { // If the CodeEditor is used then just exit;
|
||||
return;
|
||||
}
|
||||
|
||||
// The WikiEditor extension exists the WikiEditor beta toolbar is used by the user
|
||||
wikiEditorToolbarEnabled = !!mw.loader.getState( 'ext.wikiEditor' ) &&
|
||||
// This can be the string "0" if the user disabled the preference - Bug T54542#555387
|
||||
mw.user.options.get( 'usebetatoolbar' ) > 0;
|
||||
|
||||
// If WikiEditor is disabled, and the deprecated classic toolbar is unavailable then exit.
|
||||
if ( !wikiEditorToolbarEnabled && !mw.loader.getState( 'mediawiki.toolbar' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// codeMirror needs a special textselection jQuery function to work, save the current one to restore when
|
||||
// CodeMirror get's disabled.
|
||||
origTextSelection = $.fn.textSelection;
|
||||
|
@ -34,11 +45,6 @@
|
|||
}
|
||||
};
|
||||
|
||||
// The WikiEditor extension exists the WikiEditor beta toolbar is used by the user
|
||||
wikiEditorToolbarEnabled = !!mw.loader.getState( 'ext.wikiEditor' ) &&
|
||||
// This can be the string "0" if the user disabled the preference - Bug T54542#555387
|
||||
mw.user.options.get( 'usebetatoolbar' ) > 0;
|
||||
|
||||
// Disable spellchecking for Firefox users on non-Mac systems (Bug T95104)
|
||||
if ( navigator.userAgent.indexOf( 'Firefox' ) > -1 &&
|
||||
navigator.userAgent.indexOf( 'Mac' ) === -1
|
||||
|
|
Loading…
Reference in a new issue