mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-27 15:40:00 +00:00
Merge "Add translateable tooltip message for CodeMirror button"
This commit is contained in:
commit
745b2f05e1
|
@ -54,6 +54,10 @@ $wgResourceModules['ext.CodeMirror.init'] = $wgCodeMirrorResourceTemplate + arra
|
|||
'scripts' => array(
|
||||
'ext.CodeMirror.js'
|
||||
),
|
||||
'messages' => array(
|
||||
'codemirror-enable-label',
|
||||
'codemirror-disable-label',
|
||||
),
|
||||
'group' => 'ext.CodeMirror',
|
||||
);
|
||||
|
||||
|
|
|
@ -4,5 +4,7 @@
|
|||
"pastakhov"
|
||||
]
|
||||
},
|
||||
"codemirror-desc": "Provides syntax highlighting in wikitext editor"
|
||||
"codemirror-desc": "Provides syntax highlighting in wikitext editor",
|
||||
"codemirror-enable-label": "Enable CodeMirror (Syntaxhighlight)",
|
||||
"codemirror-disable-label": "Disable CodeMirror (Syntaxhighlight)"
|
||||
}
|
||||
|
|
|
@ -7,5 +7,7 @@
|
|||
"Shirayuki"
|
||||
]
|
||||
},
|
||||
"codemirror-desc": "{{desc|name=Code Mirror|url=https://www.mediawiki.org/wiki/Extension:CodeMirror}}\n\nAdditional info: Discription of \"Syntax highlighting\" in wiki\n[[mw:Extension:SyntaxHighlight GeSHi]]"
|
||||
"codemirror-desc": "{{desc|name=Code Mirror|url=https://www.mediawiki.org/wiki/Extension:CodeMirror}}\n\nAdditional info: Discription of \"Syntax highlighting\" in wiki\n[[mw:Extension:SyntaxHighlight GeSHi]]",
|
||||
"codemirror-enable-label": "Title tooltip for button to enable CodeMirror in the editing toolbar.",
|
||||
"codemirror-disable-label": "Title tooltip for button to disable CodeMirror in the editing toolbar."
|
||||
}
|
||||
|
|
|
@ -205,6 +205,8 @@
|
|||
*/
|
||||
addCodeMirrorToWikiEditor = function () {
|
||||
if ( $( '#wikiEditor-section-main' ).length > 0 ) {
|
||||
var msg = codeMirror ? 'codemirror-disable-label' : 'codemirror-enable-label';
|
||||
|
||||
$( '#wpTextbox1' ).wikiEditor(
|
||||
'addToToolbar',
|
||||
{
|
||||
|
@ -213,7 +215,7 @@
|
|||
'codemirror':{
|
||||
'tools': {
|
||||
'CodeMirror': {
|
||||
label: 'CodeMirror',
|
||||
label: mw.msg( msg ),
|
||||
type: 'button',
|
||||
// FIXME: There should be a better way?
|
||||
icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/CodeMirror/resources/images/cm-' + ( codeMirror ? 'on.png' : 'off.png' ),
|
||||
|
@ -269,11 +271,15 @@
|
|||
codeMirror = false;
|
||||
$.fn.textSelection = origTextSelection;
|
||||
$src = mw.config.get( 'wgExtensionAssetsPath' ) + '/CodeMirror/resources/images/' + ( context ? 'cm-off.png' : 'old-cm-off.png' );
|
||||
$img.attr( 'src', $src );
|
||||
$img
|
||||
.attr( 'src', $src )
|
||||
.attr( 'title', mw.msg( 'codemirror-enable-label' ) );
|
||||
} else {
|
||||
enableCodeMirror();
|
||||
$src = mw.config.get( 'wgExtensionAssetsPath' ) + '/CodeMirror/resources/images/' + ( context ? 'cm-on.png' : 'old-cm-on.png' );
|
||||
$img.attr( 'src', $src );
|
||||
$img
|
||||
.attr( 'src', $src )
|
||||
.attr( 'title', mw.msg( 'codemirror-disable-label' ) );
|
||||
setCodeEditorPreference( true );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue