Create an underline tool

Bug: 51609
Change-Id: I65246d7eeb154950c35a1cb70909a113080c2323
This commit is contained in:
Steven Zhang 2013-08-10 11:27:01 +08:00 committed by James D. Forrester
parent 6e413de883
commit 3c65d830f2
5 changed files with 51 additions and 2 deletions

View file

@ -34,6 +34,7 @@ $messages['en'] = array(
'visualeditor-annotationbutton-link-tooltip' => 'Link',
'visualeditor-annotationbutton-language-tooltip' => 'Language',
'visualeditor-annotationbutton-strikethrough-tooltip' => 'Strikethrough',
'visualeditor-annotationbutton-underline-tooltip' => 'Underline',
'visualeditor-beta-label' => 'beta',
'visualeditor-beta-warning' => 'VisualEditor is in \'beta\'. You may encounter software issues, and you may not be able to edit parts of the page. Click "{{int:visualeditor-ca-editsource}}" to switch to wikitext mode unsaved changes will be lost.',
'visualeditor-beta-appendix' => 'beta',
@ -252,6 +253,8 @@ See also:
{{Identical|Language}}',
'visualeditor-annotationbutton-strikethrough-tooltip' => 'Tooltip text for strikethrough button.
{{Identical|Strikethrough}}',
'visualeditor-annotationbutton-underline-tooltip' => 'Tooltip text for underline button.
{{Identical|Underline}}',
'visualeditor-beta-label' => 'Text of tool in the toolbar that highlights that VisualEditor is still in beta.
{{Identical|Beta}}',
'visualeditor-beta-warning' => "Note shown when user clicks on 'beta' label in VisualEditor, warning users that the software may have issues",

View file

@ -732,6 +732,7 @@ $wgResourceModules += array(
've/ui/widgets/ve.ui.LanguageInputWidget.js',
've/ui/tools/buttons/ve.ui.CodeButtonTool.js',
've/ui/tools/buttons/ve.ui.StrikethroughButtonTool.js',
've/ui/tools/buttons/ve.ui.UnderlineButtonTool.js',
),
'dependencies' => array(
'ext.visualEditor.core',
@ -744,6 +745,7 @@ $wgResourceModules += array(
'visualeditor-mwmathinspector-title',
'visualeditor-annotationbutton-language-tooltip',
'visualeditor-annotationbutton-strikethrough-tooltip',
'visualeditor-annotationbutton-underline-tooltip',
),
),

View file

@ -170,7 +170,7 @@ ve.init.mw.ViewPageTarget.compatibility = {
ve.init.mw.ViewPageTarget.static.toolbarTools = [
{ 'items': [ 'undo', 'redo' ] },
{ 'items': [ 'mwFormat' ] },
{ 'items': [ 'bold', 'italic', 'mwLink', 'language', 'code', 'strikethrough', 'clear' ] },
{ 'items': [ 'bold', 'italic', 'strikethrough', 'underline', 'mwLink', 'language', 'code', 'clear' ] },
{ 'items': [ 'number', 'bullet', 'outdent', 'indent' ] },
{ 'items': [ 'mwMediaInsert', 'mwReference', 'mwReferenceList', 'mwTransclusion', 'mwMath', 'mwHiero' ] }
];

View file

@ -32,7 +32,7 @@ ve.mixinClass( ve.init.Target, ve.EventEmitter );
ve.init.Target.static.toolbarTools = [
{ 'items': ['undo', 'redo'] },
{ 'items': ['format'] },
{ 'items': ['bold', 'italic', 'link', 'code', 'language', 'strikethrough', 'clear'] },
{ 'items': ['bold', 'italic', 'link', 'code', 'language', 'underline', 'strikethrough', 'clear'] },
{ 'items': ['number', 'bullet', 'outdent', 'indent'] }
];
@ -43,6 +43,7 @@ ve.init.Target.static.surfaceCommands = [
//'language',
'undo',
'redo',
//'underline',
//'strikethrough',
'indent',
'outdent'

View file

@ -0,0 +1,43 @@
/*!
* VisualEditor UserInterface UnderlineButtonTool class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* UserInterface underline button tool.
*
* @class
* @extends ve.ui.AnnotationButtonTool
* @constructor
* @param {ve.ui.SurfaceToolbar} toolbar
* @param {Object} [config] Config options
*/
ve.ui.UnderlineButtonTool = function VeUiUnderlineButtonTool( toolbar, config ) {
// Parent constructor
ve.ui.AnnotationButtonTool.call( this, toolbar, config );
};
/* Inheritance */
ve.inheritClass( ve.ui.UnderlineButtonTool, ve.ui.AnnotationButtonTool );
/* Static Properties */
ve.ui.UnderlineButtonTool.static.name = 'underline';
ve.ui.UnderlineButtonTool.static.icon = {
'default': 'underline-a',
'en': 'underline-u'
};
ve.ui.UnderlineButtonTool.static.titleMessage = 'visualeditor-annotationbutton-underline-tooltip';
ve.ui.UnderlineButtonTool.static.annotation = { 'name': 'textStyle/underline' };
/* Registration */
ve.ui.toolFactory.register( 'underline', ve.ui.UnderlineButtonTool );
ve.ui.commandRegistry.register( 'underline', 'annotation', 'toggle', 'textStyle/underline' );