Merge "Replace CodeMirror icons with new icons (#36C)"
|
@ -242,34 +242,40 @@
|
|||
* Adds the CodeMirror button to WikiEditor
|
||||
*/
|
||||
function addCodeMirrorToWikiEditor() {
|
||||
if ( $( '#wikiEditor-section-main' ).length > 0 ) {
|
||||
$( '#wpTextbox1' ).wikiEditor(
|
||||
'addToToolbar',
|
||||
{
|
||||
section: 'main',
|
||||
groups: {
|
||||
codemirror: {
|
||||
tools: {
|
||||
CodeMirror: {
|
||||
label: mw.msg( 'codemirror-toggle-label' ),
|
||||
type: 'button',
|
||||
offset: [ 2, 2 ],
|
||||
action: {
|
||||
type: 'callback',
|
||||
execute: function ( context ) {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
switchCodeMirror( context );
|
||||
}
|
||||
var $codeMirrorButton;
|
||||
|
||||
$( '#wpTextbox1' ).wikiEditor(
|
||||
'addToToolbar',
|
||||
{
|
||||
section: 'main',
|
||||
groups: {
|
||||
codemirror: {
|
||||
tools: {
|
||||
CodeMirror: {
|
||||
label: mw.msg( 'codemirror-toggle-label' ),
|
||||
type: 'button',
|
||||
action: {
|
||||
type: 'callback',
|
||||
execute: function () {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
switchCodeMirror();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
updateToolbarButton( $( '#wpTextbox1' ).data( 'wikiEditor-context' ) );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$codeMirrorButton = $( '#wpTextbox1' ).data( 'wikiEditor-context' ).modules.toolbar.$toolbar.find( 'a.tool[rel=CodeMirror]' );
|
||||
// FIXME in extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js
|
||||
$codeMirrorButton
|
||||
.css( 'background-image', '' )
|
||||
.attr( 'id', 'mw-editbutton-codemirror' );
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
updateToolbarButton();
|
||||
}
|
||||
|
||||
// define JQuery hook for searching and replacing text using JS if CodeMirror is enabled, see Bug: T108711
|
||||
|
@ -309,27 +315,17 @@
|
|||
|
||||
/**
|
||||
* Updates CodeMirror button on the toolbar according to the current state (on/off)
|
||||
*
|
||||
* @param {Object} [wikiEditor] WikiEditor, if present
|
||||
*/
|
||||
function updateToolbarButton( wikiEditor ) {
|
||||
if ( wikiEditor ) {
|
||||
wikiEditor.modules.toolbar.$toolbar.find( 'a.tool[rel=CodeMirror]' )
|
||||
.toggleClass( 'tool-codemirror-on', !!useCodeMirror )
|
||||
.toggleClass( 'tool-codemirror-off', !useCodeMirror );
|
||||
} else {
|
||||
$( '#mw-editbutton-codemirror' )
|
||||
.toggleClass( 'mw-editbutton-codemirror-on', !!useCodeMirror )
|
||||
.toggleClass( 'mw-editbutton-codemirror-off', !useCodeMirror );
|
||||
}
|
||||
function updateToolbarButton() {
|
||||
$( '#mw-editbutton-codemirror' )
|
||||
.toggleClass( 'mw-editbutton-codemirror-on', !!useCodeMirror )
|
||||
.toggleClass( 'mw-editbutton-codemirror-off', !useCodeMirror );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables CodeMirror
|
||||
*
|
||||
* @param {Object} [wikiEditor] WikiEditor, if present
|
||||
*/
|
||||
function switchCodeMirror( wikiEditor ) {
|
||||
function switchCodeMirror() {
|
||||
if ( codeMirror ) {
|
||||
setCodeEditorPreference( false );
|
||||
codeMirror.save();
|
||||
|
@ -342,7 +338,7 @@
|
|||
enableCodeMirror();
|
||||
setCodeEditorPreference( true );
|
||||
}
|
||||
updateToolbarButton( wikiEditor );
|
||||
updateToolbarButton();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,19 +15,25 @@
|
|||
}
|
||||
|
||||
.mw-editbutton-codemirror-on {
|
||||
.background-image-svg( 'images/old-cm-on.svg', 'images/old-cm-on.png' );
|
||||
// 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' );
|
||||
}
|
||||
}
|
||||
|
||||
.mw-editbutton-codemirror-off {
|
||||
.background-image-svg( 'images/old-cm-off.svg', 'images/old-cm-off.png' );
|
||||
}
|
||||
|
||||
.wikiEditor-ui-toolbar .tool-codemirror-on {
|
||||
.background-image-svg( 'images/cm-on.svg', 'images/cm-on.png' );
|
||||
}
|
||||
|
||||
.wikiEditor-ui-toolbar .tool-codemirror-off {
|
||||
.background-image-svg( 'images/cm-off.svg', 'images/cm-off.png' );
|
||||
// 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' );
|
||||
}
|
||||
}
|
||||
|
||||
.oo-ui-popupWidget.ve-init-mw-switchPopupWidget {
|
||||
|
|
BIN
resources/images/cm-icon.png
Normal file
After Width: | Height: | Size: 331 B |
1
resources/images/cm-icon.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24" viewBox="0 0 24 24"><g fill="#36c"><path id="a" d="M4 12v-1h1c1 0 1 0 1-1V7.614c0-.514.024-.896.073-1.142.054-.252.14-.463.257-.633.204-.28.473-.48.808-.59.335-.11.872-.25 1.835-.25H10v1h-.752c-.457 0-.77.19-.936.406-.167.216-.312.446-.312 1.07v1.856c0 .73-.04 1.18-.244 1.493-.2.307-.562.53-1.09.667.535.155.9.385 1.096.688.2.31.238.76.238 1.49v1.86c0 .62.145.85.312 1.06.166.22.48.41.936.41H10v1H8.973c-.963 0-1.5-.133-1.835-.248a1.578 1.578 0 0 1-.808-.59 1.68 1.68 0 0 1-.257-.626C6.023 16.283 6 15.9 6 15.386V13c0-1 0-1-1-1H4z"/><use transform="matrix(-1 0 0 1 24 0)" width="24" height="24" xlink:href="#a"/></g></svg>
|
After Width: | Height: | Size: 729 B |
Before Width: | Height: | Size: 675 B After Width: | Height: | Size: 425 B |
|
@ -1,25 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg4587" version="1" width="22" height="22">
|
||||
<g id="g4585" transform="translate(-8.168 -7.868) scale(.2995)">
|
||||
<circle id="circle4545" cx="85.233" cy="41.768" r="5.993"/>
|
||||
<circle id="circle4547" cx="71.773" cy="33.995" r="5.992"/>
|
||||
<circle id="circle4549" cx="93.006" cy="55.229" r="5.993"/>
|
||||
<circle id="circle4551" cx="56.226" cy="33.995" r="5.994"/>
|
||||
<circle id="circle4553" cx="93.005" cy="70.773" r="5.992"/>
|
||||
<path id="path4555" d="M38.527 37.53a5.997 5.997 0 0 1 8.478 0 5.996 5.996 0 0 1 0 8.475 5.998 5.998 0 0 1-8.478.002 5.998 5.998 0 0 1 0-8.477zm42.47 42.465a5.996 5.996 0 0 1 8.474 0 5.995 5.995 0 0 1-8.473 8.477 5.997 5.997 0 0 1 0-8.477zM36.543 49.442a5.99 5.99 0 0 1 4.24 7.338 5.99 5.99 0 0 1-7.34 4.236 5.987 5.987 0 0 1-4.237-7.34 5.987 5.987 0 0 1 7.337-4.234zM70.22 86.216a5.99 5.99 0 0 1 7.34 4.24 5.992 5.992 0 0 1-11.576 3.1 5.992 5.992 0 0 1 4.237-7.34zm-36.78-21.23a5.993 5.993 0 1 1-4.234 7.34 5.987 5.987 0 0 1 4.236-7.34z"/>
|
||||
<circle id="circle4557" cx="56.226" cy="92.005" r="5.993"/>
|
||||
<path id="path4559" d="M38.527 79.995a5.998 5.998 0 0 1 8.477 0 5.998 5.998 0 0 1 0 8.477 5.998 5.998 0 0 1-8.477 0 5.998 5.998 0 0 1 0-8.477zm0-33.99a5.998 5.998 0 0 0 8.477 0 5.996 5.996 0 0 0 0-8.476 5.997 5.997 0 0 0-8.477 0 5.998 5.998 0 0 0 0 8.474zm-5.083 15.01a5.99 5.99 0 1 0 3.1-11.573 5.988 5.988 0 0 0-7.337 4.234 5.987 5.987 0 0 0 4.237 7.34z"/>
|
||||
<circle id="circle4561" cx="34.993" cy="70.773" r="5.992"/>
|
||||
<path id="path4563" d="M47.004 88.472a5.998 5.998 0 0 0 0-8.477 5.998 5.998 0 0 0-8.477 0 5.998 5.998 0 0 0 0 8.477 5.998 5.998 0 0 0 8.477 0z"/>
|
||||
<circle id="circle4565" cx="56.228" cy="92.006" r="5.992"/>
|
||||
<path id="path4567" d="M62.017 32.445a5.993 5.993 0 0 0-11.577 3.1 5.99 5.99 0 0 0 7.338 4.24 5.996 5.996 0 0 0 4.24-7.34zm13.613 23.84a3.352 3.352 0 0 1 1.227-4.573 3.35 3.35 0 0 1 4.574 1.225 3.35 3.35 0 0 1-5.8 3.35z"/>
|
||||
<circle id="circle4569" cx="72.389" cy="48.469" r="3.347"/>
|
||||
<path id="path4571" d="M60.652 46.223a3.347 3.347 0 0 1 3.346-3.35 3.344 3.344 0 0 1 3.35 3.35 3.348 3.348 0 0 1-6.696 0zM77.43 63a3.35 3.35 0 0 1 6.7-.002 3.346 3.346 0 0 1-3.35 3.35A3.347 3.347 0 0 1 77.43 63zM53.934 45.57a3.348 3.348 0 0 1 4.576 1.226 3.347 3.347 0 0 1-1.226 4.575 3.35 3.35 0 0 1-4.575-1.223 3.353 3.353 0 0 1 1.222-4.574z"/>
|
||||
<circle id="circle4573" cx="78.531" cy="71.391" r="3.349"/>
|
||||
<path id="path4575" d="M51.142 51.713a3.348 3.348 0 1 1-4.573 1.223 3.344 3.344 0 0 1 4.57-1.223z"/>
|
||||
<circle id="circle4577" cx="72.391" cy="77.531" r="3.348"/>
|
||||
<path id="path4579" d="M50.568 63c0 1.85-1.5 3.35-3.347 3.346A3.343 3.343 0 0 1 43.877 63a3.34 3.34 0 0 1 3.346-3.348c1.853 0 3.35 1.5 3.35 3.348z"/>
|
||||
<circle id="circle4581" cx="64" cy="79.778" r="3.348"/>
|
||||
<path id="path4583" d="M47.793 68.49a3.35 3.35 0 1 1 3.35 5.8 3.35 3.35 0 0 1-3.35-5.8zM58.51 79.206a3.35 3.35 0 1 1-5.8-3.35 3.35 3.35 0 0 1 5.8 3.35z"/>
|
||||
</g>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1" width="22" height="22"><g transform="translate(-1 -.499)"><path id="a" d="M4 12v-1h1c1 0 1 0 1-1V7.614c0-.514.024-.896.073-1.142.054-.252.14-.463.257-.633.204-.28.473-.48.808-.59.335-.11.872-.25 1.835-.25H10v1h-.752c-.457 0-.77.19-.936.406-.167.216-.312.446-.312 1.07v1.856c0 .73-.04 1.18-.244 1.493-.2.307-.562.53-1.09.667.535.155.9.385 1.096.688.2.31.238.76.238 1.49v1.86c0 .62.145.85.312 1.06.166.22.48.41.936.41H10v1H8.973c-.963 0-1.5-.133-1.835-.248a1.578 1.578 0 0 1-.808-.59 1.68 1.68 0 0 1-.257-.626C6.023 16.283 6 15.9 6 15.386V13c0-1 0-1-1-1z"/><use transform="matrix(-1 0 0 1 24 0)" width="24" height="24" xlink:href="#a"/></g></svg>
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 739 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 605 B |
|
@ -1,39 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg2606" height="22" width="22" version="1">
|
||||
<g id="layer1">
|
||||
<g id="g2519" transform="translate(-8.168 -7.868) scale(.2995)">
|
||||
<circle id="circle2521" r="5.993" cy="41.768" cx="85.233" fill="#fc0"/>
|
||||
<circle id="circle2523" r="5.992" cy="33.995" cx="71.773" fill="#f90"/>
|
||||
<circle id="circle2525" r="5.993" cy="55.229" cx="93.006" fill="#ff0"/>
|
||||
<circle id="circle2527" r="5.994" cy="33.995" cx="56.226" fill="#f60"/>
|
||||
<circle id="circle2529" r="5.992" cy="70.773" cx="93.005" fill="#9f0"/>
|
||||
<path id="path2531" d="M38.527 37.53a5.997 5.997 0 0 1 8.478 0 5.996 5.996 0 0 1 0 8.475 5.998 5.998 0 0 1-8.478.002 5.998 5.998 0 0 1 0-8.477z" fill="red"/>
|
||||
<path id="path2533" d="M80.996 79.995a5.996 5.996 0 0 1 8.475 0A5.995 5.995 0 0 1 81 88.472a5.997 5.997 0 0 1 0-8.477z" fill="#0c0"/>
|
||||
<path id="path2535" d="M36.544 49.442a5.99 5.99 0 0 1 4.24 7.338 5.99 5.99 0 0 1-7.34 4.236 5.987 5.987 0 0 1-4.237-7.34 5.987 5.987 0 0 1 7.337-4.234z" fill="#c09"/>
|
||||
<path id="path2537" d="M70.222 86.216a5.99 5.99 0 0 1 7.338 4.24 5.992 5.992 0 0 1-11.575 3.1 5.992 5.992 0 0 1 4.237-7.34z" fill="#099"/>
|
||||
<path id="path2539" d="M33.443 64.985a5.993 5.993 0 1 1-4.236 7.34 5.987 5.987 0 0 1 4.236-7.34z" fill="#609"/>
|
||||
<circle id="circle2541" r="5.993" cy="92.005" cx="56.226" fill="#03c"/>
|
||||
<path id="path2543" d="M38.527 79.995a5.998 5.998 0 0 1 8.477 0 5.998 5.998 0 0 1 0 8.477 5.998 5.998 0 0 1-8.477 0 5.998 5.998 0 0 1 0-8.477z" fill="#309"/>
|
||||
<path id="path2545" d="M38.527 46.006a5.998 5.998 0 0 0 8.477-.002 5.996 5.996 0 0 0 0-8.475 5.997 5.997 0 0 0-8.477 0 5.998 5.998 0 0 0 0 8.473z" fill="none"/>
|
||||
<path id="path2547" d="M33.444 61.016a5.99 5.99 0 1 0 3.1-11.574 5.988 5.988 0 0 0-7.337 4.234 5.987 5.987 0 0 0 4.237 7.34z" fill="none"/>
|
||||
<circle id="circle2549" r="5.992" cy="70.773" cx="34.993" fill="none"/>
|
||||
<path id="path2551" d="M47.004 88.472a5.998 5.998 0 0 0 0-8.477 5.998 5.998 0 0 0-8.477 0 5.998 5.998 0 0 0 0 8.477 5.998 5.998 0 0 0 8.477 0z" fill="none"/>
|
||||
<circle id="circle2553" r="5.992" cy="92.006" cx="56.228" fill="none"/>
|
||||
<path id="path2555" d="M62.017 32.445a5.993 5.993 0 0 0-11.577 3.1 5.99 5.99 0 0 0 7.338 4.24 5.996 5.996 0 0 0 4.24-7.34z" fill="none"/>
|
||||
<g id="XMLID_1_">
|
||||
<path id="path2558" d="M75.63 56.286a3.352 3.352 0 0 1 1.227-4.574 3.35 3.35 0 0 1 4.574 1.225 3.35 3.35 0 0 1-5.8 3.35z" fill="#ffe500"/>
|
||||
<circle id="circle2560" r="3.347" cy="48.469" cx="72.389" fill="#ffb200"/>
|
||||
<path id="path2562" d="M60.652 46.223a3.347 3.347 0 0 1 3.346-3.35 3.344 3.344 0 0 1 3.35 3.35 3.348 3.348 0 0 1-6.696 0z" fill="#ff8000"/>
|
||||
<path id="path2564" d="M77.43 63a3.348 3.348 0 0 1 6.7-.002 3.346 3.346 0 0 1-3.35 3.35A3.347 3.347 0 0 1 77.43 63z" fill="#cf0"/>
|
||||
<path id="path2566" d="M53.934 45.57a3.348 3.348 0 0 1 4.576 1.226 3.347 3.347 0 0 1-1.226 4.575 3.35 3.35 0 0 1-4.575-1.222 3.353 3.353 0 0 1 1.22-4.574z" fill="#f30"/>
|
||||
<circle id="circle2568" r="3.349" cy="71.391" cx="78.531" fill="#3f0"/>
|
||||
<path id="path2570" d="M51.142 51.713a3.348 3.348 0 1 1-4.573 1.223 3.344 3.344 0 0 1 4.57-1.223z" fill="#e50066"/>
|
||||
<circle id="circle2572" r="3.348" cy="77.531" cx="72.391" fill="#00b266"/>
|
||||
<path id="path2574" d="M50.568 63c0 1.85-1.5 3.35-3.347 3.346A3.343 3.343 0 0 1 43.878 63a3.34 3.34 0 0 1 3.346-3.348c1.853 0 3.35 1.5 3.35 3.348z" fill="#909"/>
|
||||
<circle id="circle2576" r="3.348" cy="79.778" cx="64" fill="#0066b2"/>
|
||||
<path id="path2578" d="M47.793 68.49a3.35 3.35 0 1 1 3.35 5.8 3.35 3.35 0 0 1-3.35-5.8z" fill="#400099"/>
|
||||
<path id="path2580" d="M58.51 79.206a3.35 3.35 0 1 1-5.8-3.35 3.35 3.35 0 0 1 5.8 3.35z" fill="#1919b2"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="22" width="22" version="1"><defs><clipPath id="a"><path transform="scale(-1)" opacity=".546" fill="none" stroke-width="1.417" d="M0 0h22v22H0z"/></clipPath></defs><image clip-path="url(#a)" transform="scale(-1)" width="45.28" height="33" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAhCAIAAACX21boAAAAOklEQVR4AUxMhRVAQQjy3f4L/zjs bgXOBQ4RdTJnt52jx50bg8Rcbm7ne3ntqeE6nFzuO7TLvr5+CgCX2x/ak7EiEwAAAABJRU5ErkJg gg==" x="-32.428" y="-27.5" fill="none" image-rendering="optimizeSpeed"/><g transform="translate(-1 -.499)" fill="#36c"><path id="b" d="M4 12v-1h1c1 0 1 0 1-1V7.614c0-.514.024-.896.073-1.142.054-.252.14-.463.257-.633.204-.28.473-.48.808-.59.335-.11.872-.25 1.835-.25H10v1h-.752c-.457 0-.77.19-.936.406-.167.216-.312.446-.312 1.07v1.856c0 .73-.04 1.18-.244 1.493-.2.307-.562.53-1.09.667.535.155.9.385 1.096.688.2.31.238.76.238 1.49v1.86c0 .62.145.85.312 1.06.166.22.48.41.936.41H10v1H8.973c-.963 0-1.5-.133-1.835-.248a1.578 1.578 0 0 1-.808-.59 1.68 1.68 0 0 1-.257-.626C6.023 16.283 6 15.9 6 15.386V13c0-1 0-1-1-1z"/><use transform="matrix(-1 0 0 1 24 0)" width="24" height="24" xlink:href="#b"/></g><path fill="none" stroke="#dae5ec" d="M.5.5h21v21H.5z"/><path fill="none" stroke="#eef2f6" d="M.976 1.024h20v20h-20z"/></svg>
|
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 949 B |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 904 B |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 3.6 KiB |