Esanders has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402032 )

Change subject: Expect that deprecated mediawiki.toolbar may not be available
......................................................................

Expect that deprecated mediawiki.toolbar may not be available

Bug: T177098
Change-Id: Icaf51c234981b4572362a0d76bf0b4b6653f3854
---
M resources/ext.CodeMirror.js
1 file changed, 12 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CodeMirror 
refs/changes/32/402032/1

diff --git a/resources/ext.CodeMirror.js b/resources/ext.CodeMirror.js
index 4ab2a72..bee0f23 100644
--- a/resources/ext.CodeMirror.js
+++ b/resources/ext.CodeMirror.js
@@ -1,8 +1,19 @@
 ( 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;
        }
 
@@ -33,11 +44,6 @@
                        elem.value = value;
                }
        };
-
-       // 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 &&

-- 
To view, visit https://gerrit.wikimedia.org/r/402032
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icaf51c234981b4572362a0d76bf0b4b6653f3854
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CodeMirror
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to