Esanders has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/402036 )
Change subject: Remove support for classic toolbar (mediawiki.toolbar) ...................................................................... Remove support for classic toolbar (mediawiki.toolbar) The classic toolbar is deprecated. Bug: T177098 Change-Id: I22bebd63d69346cc6cdb22972c77f0639a3caa90 --- M resources/ext.CodeMirror.js M resources/ext.CodeMirror.less D resources/images/old-cm-off.svg D resources/images/old-cm-on.svg 4 files changed, 13 insertions(+), 169 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CodeMirror refs/changes/36/402036/1 diff --git a/resources/ext.CodeMirror.js b/resources/ext.CodeMirror.js index bee0f23..8959391 100644 --- a/resources/ext.CodeMirror.js +++ b/resources/ext.CodeMirror.js @@ -1,19 +1,17 @@ ( function ( mw, $ ) { - var origTextSelection, useCodeMirror, codeMirror, api, originHooksTextarea, - wikiEditorToolbarEnabled, textBox, + var origTextSelection, useCodeMirror, codeMirror, api, originHooksTextarea, 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' ) && + // If WikiEditor is disabled or unavailable then exit. + if ( + !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' ) ) { + mw.user.options.get( 'usebetatoolbar' ) <= 0 + ) { return; } @@ -357,10 +355,6 @@ lang: $textbox1.attr( 'lang' ) } ); - if ( !wikiEditorToolbarEnabled ) { - $codeMirror.addClass( 'mw-codeMirror-classicToolbar' ); - } - // set the height of the textarea codeMirror.setSize( null, $textbox1.height() ); // Overwrite default textselection of WikiEditor to work with CodeMirror, too @@ -450,32 +444,10 @@ * Adds CodeMirror button to the toolbar */ function addToolbarButton() { - // Check if the user is using the enhanced editing toolbar (supplied by the - // WikiEditor extension) or the default editing toolbar (supplied by core). - if ( wikiEditorToolbarEnabled ) { - // They are using the enhanced editing toolbar. - mw.loader.using( 'ext.wikiEditor.toolbar', function () { - // Add CodeMirror button to the enhanced editing toolbar. - $( addCodeMirrorToWikiEditor ); - } ); - } else { - // They are using the default editing toolbar. - mw.loader.using( 'mediawiki.toolbar', function () { - // Add CodeMirror button to the default editing toolbar. - mw.toolbar.addButton( { - speedTip: mw.msg( 'codemirror-toggle-label' ), - imageId: 'mw-editbutton-codemirror', - onClick: function () { - switchCodeMirror(); - return false; - } - } ); - // We don't know when button will be added, wait until the document is ready to update it - $( function () { - updateToolbarButton(); - } ); - } ); - } + mw.loader.using( 'ext.wikiEditor.toolbar', function () { + // Add CodeMirror button to the enhanced editing toolbar. + $( addCodeMirrorToWikiEditor ); + } ); } /** @@ -562,11 +534,7 @@ // enable CodeMirror if ( useCodeMirror ) { - if ( wikiEditorToolbarEnabled ) { - $( '#wpTextbox1' ).on( 'wikiEditor-toolbar-doneInitialSections', enableCodeMirror.bind( this ) ); - } else { - enableCodeMirror(); - } + $( '#wpTextbox1' ).on( 'wikiEditor-toolbar-doneInitialSections', enableCodeMirror.bind( this ) ); } // Synchronize textarea with CodeMirror before leaving diff --git a/resources/ext.CodeMirror.less b/resources/ext.CodeMirror.less index 3f8cce9..71ca355 100644 --- a/resources/ext.CodeMirror.less +++ b/resources/ext.CodeMirror.less @@ -9,35 +9,17 @@ clear: both; } -.mw-codeMirror-classicToolbar { - border: 1px solid #a2a9b1; -} - .CodeMirror pre, .CodeMirror-lines { padding: 0; } .mw-editbutton-codemirror-on { - // WikiEditor toolbar - &.tool-button { - .background-image-svg( 'images/cm-on.svg', 'images/cm-on.png' ); - } - // Classic toolbar - &.mw-toolbar-editbutton { - .background-image-svg( 'images/old-cm-on.svg', 'images/old-cm-on.png' ); - } + .background-image-svg( 'images/cm-on.svg', 'images/cm-on.png' ); } .mw-editbutton-codemirror-off { - // WikiEditor toolbar - &.tool-button { - .background-image-svg( 'images/cm-off.svg', 'images/cm-off.png' ); - } - // Classic toolbar - &.mw-toolbar-editbutton { - .background-image-svg( 'images/old-cm-off.svg', 'images/old-cm-off.png' ); - } + .background-image-svg( 'images/cm-off.svg', 'images/cm-off.png' ); } .wikiEditor-ui-toolbar, diff --git a/resources/images/old-cm-off.svg b/resources/images/old-cm-off.svg deleted file mode 100644 index 76b39e4..0000000 --- a/resources/images/old-cm-off.svg +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="22" width="23"> - <defs> - <linearGradient id="a"> - <stop offset="0" stop-color="#d7e7fe"/> - <stop offset=".632" stop-color="#a3b6d0"/> - <stop offset=".895" stop-color="#90a3bd"/> - <stop offset="1" stop-color="#7588a3"/> - </linearGradient> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="o" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="b" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="c" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="d" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="e" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="f" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="g" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="h" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="i" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="j" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="k" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="l" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="m" y2="20.5" x2="0" y1="1.5"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="n" y2="20.5" x2="0" y1="1.5"/> - </defs> - <path fill="url(#b)" d="M.5.5h22v21H.5z"/> - <path fill="url(#c)" d="M.5.5h22v21H.5z"/> - <path fill="url(#d)" d="M.5.5h22v21H.5z"/> - <path fill="url(#e)" d="M.5.5h22v21H.5z"/> - <path fill="url(#f)" d="M.5.5h22v21H.5z"/> - <path fill="url(#g)" d="M.5.5h22v21H.5z"/> - <path fill="url(#h)" d="M.5.5h22v21H.5z"/> - <path fill="url(#i)" d="M.5.5h22v21H.5z"/> - <path fill="url(#j)" d="M.5.5h22v21H.5z"/> - <path fill="url(#k)" d="M.5.5h22v21H.5z"/> - <path fill="url(#l)" d="M.5.5h22v21H.5z"/> - <path fill="url(#m)" d="M.5.5h22v21H.5z"/> - <path fill="url(#n)" d="M.5.5h22v21H.5z"/> - <path fill="url(#o)" d="M.5.5h22v21H.5z"/> - <path d="M22.1 0v1H1v20.1H0V.9S0 0 .9 0" fill="#fff"/> - <path d="M22 1l.1-1s.9 0 .9.9v20.2s0 .9-.9.9H.9s-.9 0-.9-.9l1-.1h21" fill="#435978"/> - <g transform="translate(2.2,1.8)"> - <path id="p" - d="M 18.29 6.29 14.71 2.71 a 1 1 0 0 0 -1.41 0 L 3.71 12.29 a 1 1 0 0 0 0 1.41 L 4 14 1 18 H 6 - l 1 -1 .29 .29 a 1 1 0 0 0 1.41 0 l 9.59 -9.59 A 1 1 0 0 0 18.29 6.29 Z M 7 15 5 13 l 9 -9 2 2 Z"/> - </g> -</svg> \ No newline at end of file diff --git a/resources/images/old-cm-on.svg b/resources/images/old-cm-on.svg deleted file mode 100644 index 8f174c5..0000000 --- a/resources/images/old-cm-on.svg +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="22" width="23"> - <defs> - <linearGradient id="a"> - <stop offset="0" stop-color="#d7e7fe"/> - <stop offset=".632" stop-color="#a3b6d0"/> - <stop offset=".895" stop-color="#90a3bd"/> - <stop offset="1" stop-color="#7588a3"/> - </linearGradient> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="o" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="b" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="c" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="d" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="e" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="f" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="g" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="h" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="i" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="j" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="k" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="l" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="m" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - <linearGradient gradientUnits="userSpaceOnUse" xlink:href="#a" id="n" y2="20.5" x2="0" y1="1.5" - gradientTransform="rotate(-180 11.5 11)"/> - </defs> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#b)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#c)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#d)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#e)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#f)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#g)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#h)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#i)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#j)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#k)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#l)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#m)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#n)"/> - <path d="M22.5 21.5H.5V.5h22z" fill="url(#o)"/> - <path d="M.9 22v-1H22V.9h1v20.2s0 .9-.9.9" fill="#fff"/> - <path d="M1 21l-.1 1s-.9 0-.9-.9V.9S0 0 .9 0h21.2s.9 0 .9.9L22 1H1" fill="#435978"/> - <g transform="translate(2.2,1.8)" fill="#36c"> - <path id="p" - d="M 18.29 6.29 14.71 2.71 a 1 1 0 0 0 -1.41 0 L 3.71 12.29 a 1 1 0 0 0 0 1.41 L 4 14 1 18 H 6 - l 1 -1 .29 .29 a 1 1 0 0 0 1.41 0 l 9.59 -9.59 A 1 1 0 0 0 18.29 6.29 Z M 7 15 5 13 l 9 -9 2 2 Z"/> - </g> -</svg> \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/402036 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I22bebd63d69346cc6cdb22972c77f0639a3caa90 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CodeMirror Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits