Merge "(bug 40735) Enabling editors to distinguish dashes in the WikiEditor"

This commit is contained in:
Trevor Parscal 2012-10-19 17:58:46 +00:00 committed by Gerrit Code Review
commit 5590c1d0ef
4 changed files with 58 additions and 6 deletions

View file

@ -202,6 +202,9 @@ $1:Example.jpg|Caption2",
'wikieditor-toolbar-characters-page-thai' => 'Thai',
'wikieditor-toolbar-characters-page-lao' => 'Lao',
'wikieditor-toolbar-characters-page-khmer' => 'Khmer',
'wikieditor-toolbar-characters-endash' => 'en dash',
'wikieditor-toolbar-characters-emdash' => 'em dash',
'wikieditor-toolbar-characters-minus' => 'minus sign',
/* Toolbar - Help Section */
'wikieditor-toolbar-section-help' => 'Help',
'wikieditor-toolbar-help-heading-description' => 'Description',
@ -452,6 +455,9 @@ For more information, see http://www.mediawiki.org/wiki/Extension:WikiEditor/Too
For more information, see http://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization',
'wikieditor-toolbar-characters-page-telugu' => 'The name of the [[w:Telugu language#Alphabet|Telugu]] character set (alphabet) on the toolbar.
For more information, see http://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization',
'wikieditor-toolbar-characters-endash' => 'Title tooltip for the en dash character (); See https://en.wikipedia.org/wiki/Dash',
'wikieditor-toolbar-characters-emdash' => 'Title tooltip for the em dash character (—); See https://en.wikipedia.org/wiki/Dash',
'wikieditor-toolbar-characters-minus' => 'Title tooltip for the minus sign character (), not to be confused with a hyphen',
'wikieditor-toolbar-section-help' => '{{Identical|Help}}',
'wikieditor-toolbar-help-heading-description' => '{{Identical|Description}}',
'wikieditor-toolbar-help-page-link' => '{{Identical|Links}}',

View file

@ -341,6 +341,9 @@ $wgResourceModules += array(
'wikieditor-toolbar-characters-page-thai',
'wikieditor-toolbar-characters-page-lao',
'wikieditor-toolbar-characters-page-khmer',
'wikieditor-toolbar-characters-endash',
'wikieditor-toolbar-characters-emdash',
'wikieditor-toolbar-characters-minus',
/* Help Section */
'wikieditor-toolbar-section-help',
'wikieditor-toolbar-help-heading-description',

View file

@ -613,9 +613,42 @@ getDefaultConfig: function() {
"\u20ac", "\u20a0", "\u20a3", "\u0192", "\u20b4", "\u20ad", "\u20a4", "\u2133", "\u20a5",
"\u20a6", "\u2116", "\u20a7", "\u20b0", "\u00a3", "\u17db", "\u20a8", "\u20aa", "\u09f3",
"\u20ae", "\u20a9", "\u00a5", "\u2660", "\u2663", "\u2665", "\u2666", "m\u00b2", "m\u00b3",
"\u2013", "\u2014", "\u2026", "\u2018", "\u2019", "\u201c", "\u201d", "\u00b0", "\u2032",
"\u2033", "\u2248", "\u2260", "\u2264", "\u2265", "\u00b1", "\u2212", "\u00d7", "\u00f7",
"\u2190", "\u2192", "\u00b7", "\u00a7", "\u203D"
{
'label': "\u2013",
'titleMsg': 'wikieditor-toolbar-characters-endash',
'action' : {
'type' : 'replace',
'options' : {
'peri' : "\u2013",
'selectPeri': false
}
}
},
{
'label': "\u2014",
'titleMsg': 'wikieditor-toolbar-characters-emdash',
'action' : {
'type' : 'replace',
'options' : {
'peri' : "\u2014",
'selectPeri': false
}
}
},
"\u2026", "\u2018", "\u2019", "\u201c", "\u201d", "\u00b0", "\u2032",
"\u2033", "\u2248", "\u2260", "\u2264", "\u2265", "\u00b1",
{
'label': "\u2212",
'titleMsg': 'wikieditor-toolbar-characters-minus',
'action' : {
'type' : 'replace',
'options' : {
'peri' : "\u2212",
'selectPeri': false
}
}
},
"\u00d7", "\u00f7", "\u2190", "\u2192", "\u00b7", "\u00a7", "\u203D"
]
},
'greek': {

View file

@ -1,7 +1,7 @@
/**
* Toolbar module for wikiEditor
*/
( function( $ ) { $.wikiEditor.modules.toolbar = {
( function ( mw, $ ) { $.wikiEditor.modules.toolbar = {
/**
* API accessible functions
@ -563,6 +563,8 @@ fn: {
}
}
};
// In some cases the label for the character isn't the same as the
// character that gets inserted (e.g. Hebrew vowels)
} else if ( character && 0 in character && 1 in character ) {
character = {
'label' : character[0],
@ -577,7 +579,15 @@ fn: {
}
if ( character && 'action' in character && 'label' in character ) {
actions[character.label] = character.action;
return '<span rel="' + character.label + '">' + character.label + '</span>';
if ( character.titleMsg !== undefined ) {
return mw.html.element(
'span',
{ 'rel': character.label, 'title': mw.msg( character.titleMsg ) },
character.label
);
} else {
return mw.html.element( 'span', { 'rel': character.label }, character.label );
}
}
mw.log( "A character for the toolbar was undefined. This is not supposed to happen. Double check the config." );
return ""; // bug 31673; also an additional fix for bug 24208...
@ -780,4 +790,4 @@ fn: {
}
}
}; } )( jQuery );
}; } )( mediaWiki, jQuery );