Drop support for MediaWiki core's removed "2006 wikitext editor"

Change-Id: Ib8d104ddf104cfeeee1fc7a055293a03fe8e2d3d
This commit is contained in:
James D. Forrester 2018-10-25 13:41:01 -07:00
parent 079d240a2c
commit 8ac2d11b1b
6 changed files with 13 additions and 175 deletions

View file

@ -1,19 +1,14 @@
( function ( mw, $ ) {
var useCodeMirror, codeMirror, api, originHooksTextarea,
wikiEditorToolbarEnabled, cmTextSelection,
var useCodeMirror, codeMirror, api, originHooksTextarea, cmTextSelection,
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' ) ) {
// Exit if WikiEditor is disabled
// usebetatoolbar can be the string "0" if the user disabled the preference - Bug T54542#555387
if ( !( mw.loader.getState( 'ext.wikiEditor' ) && mw.user.options.get( 'usebetatoolbar' ) > 0 ) ) {
return;
}
@ -173,10 +168,6 @@
// T194102: UniversalLanguageSelector integration is buggy, disabling it completely
$( codeMirror.getInputField() ).addClass( 'noime' );
if ( !wikiEditorToolbarEnabled ) {
$codeMirror.addClass( 'mw-codeMirror-classicToolbar' );
}
// set the height of the textarea
codeMirror.setSize( null, $textbox1.height() );
} );
@ -188,9 +179,8 @@
function updateToolbarButton() {
var $button = $( '#mw-editbutton-codemirror' );
$button
// For Classic and WikiEditor2010 toolbar
.toggleClass( 'mw-editbutton-codemirror-active', !!useCodeMirror );
$button.toggleClass( 'mw-editbutton-codemirror-active', !!useCodeMirror );
// WikiEditor2010 OOUI ToggleButtonWidget
if ( $button.data( 'setActive' ) ) {
$button.data( 'setActive' )( !!useCodeMirror );
@ -201,12 +191,7 @@
* Enables or disables CodeMirror
*/
function switchCodeMirror() {
var selectionObj,
selectionStart,
selectionEnd,
scrollTop,
hasFocus,
$codeMirror,
var selectionObj, selectionStart, selectionEnd, scrollTop, hasFocus, $codeMirror,
$textbox1 = $( '#wpTextbox1' );
if ( codeMirror ) {
@ -275,32 +260,11 @@
* 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 WikiEditor
mw.loader.using( 'ext.wikiEditor', 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();
} );
} );
}
}
// If view is in edit mode, add the button to the toolbar.
@ -310,11 +274,7 @@
// enable CodeMirror
if ( useCodeMirror ) {
if ( wikiEditorToolbarEnabled ) {
$( '#wpTextbox1' ).on( 'wikiEditor-toolbar-doneInitialSections', enableCodeMirror.bind( this ) );
} else {
enableCodeMirror();
}
}
// Synchronize textarea with CodeMirror before leaving

View file

@ -9,27 +9,11 @@
clear: both;
}
.mw-codeMirror-classicToolbar {
border: 1px solid #a2a9b1;
}
.CodeMirror pre,
.CodeMirror-lines {
padding: 0;
}
// Classic toolbar
&.mw-toolbar-editbutton {
.background-image-svg( 'images/old-cm-off.svg', 'images/old-cm-off.png' );
}
.mw-editbutton-codemirror-active {
// Classic toolbar
&.mw-toolbar-editbutton {
.background-image-svg( 'images/old-cm-on.svg', 'images/old-cm-on.png' );
}
}
.wikiEditor-ui-toolbar,
.oo-ui-popupWidget.ve-init-mw-switchPopupWidget {
// Increase z-index to above scrollbar

Binary file not shown.

Before

Width:  |  Height:  |  Size: 796 B

View file

@ -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>

Before

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 749 B

View file

@ -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>

Before

Width:  |  Height:  |  Size: 3.9 KiB