mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-23 22:03:28 +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(
|
'scripts' => array(
|
||||||
'ext.CodeMirror.js'
|
'ext.CodeMirror.js'
|
||||||
),
|
),
|
||||||
|
'messages' => array(
|
||||||
|
'codemirror-enable-label',
|
||||||
|
'codemirror-disable-label',
|
||||||
|
),
|
||||||
'group' => 'ext.CodeMirror',
|
'group' => 'ext.CodeMirror',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,7 @@
|
||||||
"pastakhov"
|
"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"
|
"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 () {
|
addCodeMirrorToWikiEditor = function () {
|
||||||
if ( $( '#wikiEditor-section-main' ).length > 0 ) {
|
if ( $( '#wikiEditor-section-main' ).length > 0 ) {
|
||||||
|
var msg = codeMirror ? 'codemirror-disable-label' : 'codemirror-enable-label';
|
||||||
|
|
||||||
$( '#wpTextbox1' ).wikiEditor(
|
$( '#wpTextbox1' ).wikiEditor(
|
||||||
'addToToolbar',
|
'addToToolbar',
|
||||||
{
|
{
|
||||||
|
@ -213,7 +215,7 @@
|
||||||
'codemirror':{
|
'codemirror':{
|
||||||
'tools': {
|
'tools': {
|
||||||
'CodeMirror': {
|
'CodeMirror': {
|
||||||
label: 'CodeMirror',
|
label: mw.msg( msg ),
|
||||||
type: 'button',
|
type: 'button',
|
||||||
// FIXME: There should be a better way?
|
// FIXME: There should be a better way?
|
||||||
icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/CodeMirror/resources/images/cm-' + ( codeMirror ? 'on.png' : 'off.png' ),
|
icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/CodeMirror/resources/images/cm-' + ( codeMirror ? 'on.png' : 'off.png' ),
|
||||||
|
@ -269,11 +271,15 @@
|
||||||
codeMirror = false;
|
codeMirror = false;
|
||||||
$.fn.textSelection = origTextSelection;
|
$.fn.textSelection = origTextSelection;
|
||||||
$src = mw.config.get( 'wgExtensionAssetsPath' ) + '/CodeMirror/resources/images/' + ( context ? 'cm-off.png' : 'old-cm-off.png' );
|
$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 {
|
} else {
|
||||||
enableCodeMirror();
|
enableCodeMirror();
|
||||||
$src = mw.config.get( 'wgExtensionAssetsPath' ) + '/CodeMirror/resources/images/' + ( context ? 'cm-on.png' : 'old-cm-on.png' );
|
$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 );
|
setCodeEditorPreference( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue