r105721 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105720‎ | r105721 | r105722 >
Date:21:16, 9 December 2011
Author:tparscal
Status:deferred
Tags:
Comment:
* Added shortcut for links (ctrl/cmd + K)
* Added title attributes for tools
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/bases/es.Tool.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.AnnotationButtonTool.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.ButtonTool.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.ClearButtonTool.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.DropdownTool.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.FormatDropdownTool.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.HistoryButtonTool.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.IndentationButtonTool.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.ListButtonTool.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/views/es.ToolbarView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/tools/es.ClearButtonTool.js
@@ -7,9 +7,9 @@
88 * @param {es.ToolbarView} toolbar
99 * @param {String} name
1010 */
11 -es.ClearButtonTool = function( toolbar, name ) {
 11+es.ClearButtonTool = function( toolbar, name, title ) {
1212 // Inheritance
13 - es.ButtonTool.call( this, toolbar, name );
 13+ es.ButtonTool.call( this, toolbar, name, title );
1414
1515 // Properties
1616 this.$.addClass( 'es-toolbarButtonTool-disabled' );
@@ -45,8 +45,9 @@
4646 /* Registration */
4747
4848 es.Tool.tools.clear = {
49 - constructor: es.ClearButtonTool,
50 - name: 'clear'
 49+ 'constructor': es.ClearButtonTool,
 50+ 'name': 'clear',
 51+ 'title': 'Clear formatting'
5152 };
5253
5354 /* Inheritance */
Index: trunk/extensions/VisualEditor/modules/es/tools/es.FormatDropdownTool.js
@@ -8,9 +8,9 @@
99 * @param {String} name
1010 * @param {Object[]} items
1111 */
12 -es.FormatDropdownTool = function( toolbar, name ) {
 12+es.FormatDropdownTool = function( toolbar, name, title ) {
1313 // Inheritance
14 - es.DropdownTool.call( this, toolbar, name, [
 14+ es.DropdownTool.call( this, toolbar, name, title, [
1515 {
1616 'name': 'paragraph',
1717 'label': 'Paragraph',
@@ -109,7 +109,8 @@
110110
111111 es.Tool.tools.format = {
112112 'constructor': es.FormatDropdownTool,
113 - 'name': 'format'
 113+ 'name': 'format',
 114+ 'title': 'Change format'
114115 };
115116
116117 /* Inheritance */
Index: trunk/extensions/VisualEditor/modules/es/tools/es.AnnotationButtonTool.js
@@ -8,9 +8,9 @@
99 * @param {String} name
1010 * @param {Object} annotation
1111 */
12 -es.AnnotationButtonTool = function( toolbar, name, data ) {
 12+es.AnnotationButtonTool = function( toolbar, name, title, data ) {
1313 // Inheritance
14 - es.ButtonTool.call( this, toolbar, name );
 14+ es.ButtonTool.call( this, toolbar, name, title );
1515
1616 // Properties
1717 this.annotation = data.annotation;
@@ -50,6 +50,7 @@
5151 es.Tool.tools.bold = {
5252 'constructor': es.AnnotationButtonTool,
5353 'name': 'bold',
 54+ 'title': 'Bold (ctrl/cmd + B)',
5455 'data': {
5556 'annotation': { 'type': 'textStyle/bold' }
5657 }
@@ -58,6 +59,7 @@
5960 es.Tool.tools.italic = {
6061 'constructor': es.AnnotationButtonTool,
6162 'name': 'italic',
 63+ 'title': 'Italic (ctrl/cmd + I)',
6264 'data': {
6365 'annotation': { 'type': 'textStyle/italic' }
6466 }
@@ -66,6 +68,7 @@
6769 es.Tool.tools.link = {
6870 'constructor': es.AnnotationButtonTool,
6971 'name': 'link',
 72+ 'title': 'Link (ctrl/cmd + K)',
7073 'data': {
7174 'annotation': { 'type': 'link/internal', 'data': { 'title': '' } },
7275 'inspector': 'link'
Index: trunk/extensions/VisualEditor/modules/es/tools/es.ListButtonTool.js
@@ -7,9 +7,9 @@
88 * @param {es.ToolbarView} toolbar
99 * @param {String} name
1010 */
11 - es.ListButtonTool = function( toolbar, name, data ) {
 11+ es.ListButtonTool = function( toolbar, name, title, data ) {
1212 // Inheritance
13 - es.ButtonTool.call( this, toolbar, name );
 13+ es.ButtonTool.call( this, toolbar, name, title );
1414
1515 // Properties
1616 this.data = data;
@@ -304,13 +304,15 @@
305305 /* Registration */
306306
307307 es.Tool.tools.number = {
308 - constructor: es.ListButtonTool,
309 - name: 'number'
 308+ 'constructor': es.ListButtonTool,
 309+ 'name': 'number',
 310+ 'title': 'Numbered list'
310311 };
311312
312313 es.Tool.tools.bullet = {
313 - constructor: es.ListButtonTool,
314 - name: 'bullet'
 314+ 'constructor': es.ListButtonTool,
 315+ 'name': 'bullet',
 316+ 'title': 'Bulleted list'
315317 };
316318
317319 /* Inheritance */
Index: trunk/extensions/VisualEditor/modules/es/tools/es.IndentationButtonTool.js
@@ -7,8 +7,8 @@
88 * @param {es.ToolbarView} toolbar
99 * @param {String} name
1010 */
11 - es.IndentationButtonTool = function( toolbar, name, data ) {
12 - es.ButtonTool.call( this, toolbar, name );
 11+ es.IndentationButtonTool = function( toolbar, name, title, data ) {
 12+ es.ButtonTool.call( this, toolbar, name, title );
1313 this.data = data;
1414 };
1515
@@ -100,13 +100,15 @@
101101 /* Registration */
102102
103103 es.Tool.tools.indent = {
104 - constructor: es.IndentationButtonTool,
105 - name: 'indent'
 104+ 'constructor': es.IndentationButtonTool,
 105+ 'name': 'indent',
 106+ 'title': 'Increase indentation'
106107 };
107108
108109 es.Tool.tools.outdent = {
109 - constructor: es.IndentationButtonTool,
110 - name: 'outdent'
 110+ 'constructor': es.IndentationButtonTool,
 111+ 'name': 'outdent',
 112+ 'title': 'Reduce indentation'
111113 };
112114
113115 /* Inheritance */
Index: trunk/extensions/VisualEditor/modules/es/tools/es.ButtonTool.js
@@ -6,9 +6,9 @@
77 * @param {es.ToolbarView} toolbar
88 * @param {String} name
99 */
10 -es.ButtonTool = function( toolbar, name ) {
 10+es.ButtonTool = function( toolbar, name, title ) {
1111 // Inheritance
12 - es.Tool.call( this, toolbar, name );
 12+ es.Tool.call( this, toolbar, name, title );
1313 if ( !name ) {
1414 return;
1515 }
Index: trunk/extensions/VisualEditor/modules/es/tools/es.DropdownTool.js
@@ -7,9 +7,9 @@
88 * @param {String} name
99 * @param {Object[]} items
1010 */
11 -es.DropdownTool = function( toolbar, name, items ) {
 11+es.DropdownTool = function( toolbar, name, title, items ) {
1212 // Inheritance
13 - es.Tool.call( this, toolbar, name );
 13+ es.Tool.call( this, toolbar, name, title );
1414 if ( !name ) {
1515 return;
1616 }
Index: trunk/extensions/VisualEditor/modules/es/tools/es.HistoryButtonTool.js
@@ -7,9 +7,9 @@
88 * @param {es.ToolbarView} toolbar
99 * @param {String} name
1010 */
11 -es.HistoryButtonTool = function( toolbar, name, data ) {
 11+es.HistoryButtonTool = function( toolbar, name, title, data ) {
1212 // Inheritance
13 - es.ButtonTool.call( this, toolbar, name );
 13+ es.ButtonTool.call( this, toolbar, name, title );
1414
1515 // Properties
1616 this.data = data;
@@ -35,13 +35,15 @@
3636 /* Registration */
3737
3838 es.Tool.tools.undo = {
39 - constructor: es.HistoryButtonTool,
40 - name: 'undo'
 39+ 'constructor': es.HistoryButtonTool,
 40+ 'name': 'undo',
 41+ 'title': 'Undo (ctrl/cmd + Z)'
4142 };
4243
4344 es.Tool.tools.redo = {
44 - constructor: es.HistoryButtonTool,
45 - name: 'redo'
 45+ 'constructor': es.HistoryButtonTool,
 46+ 'name': 'redo',
 47+ 'title': 'Redo (ctrl/cmd + shift + Z)'
4648 };
4749
4850 /* Inhertiance */
Index: trunk/extensions/VisualEditor/modules/es/bases/es.Tool.js
@@ -6,10 +6,11 @@
77 * @param {es.ToolbarView} toolbar
88 * @param {String} name
99 */
10 -es.Tool = function( toolbar, name ) {
 10+es.Tool = function( toolbar, name, title ) {
1111 this.toolbar = toolbar;
1212 this.name = name;
13 - this.$ = $( '<div class="es-tool"></div>' ).attr( 'title', this.name );
 13+ this.title = title;
 14+ this.$ = $( '<div class="es-tool"></div>' ).attr( 'title', this.title );
1415 };
1516
1617 /* Static Members */
Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
@@ -615,6 +615,10 @@
616616 case 73:
617617 this.annotate( 'toggle', {'type': 'textStyle/italic' } );
618618 return false;
 619+ // k (hyperlink)
 620+ case 75:
 621+ this.contextView.openInspector( 'link' );
 622+ return false;
619623 }
620624 }
621625 // Regular text insertion
Index: trunk/extensions/VisualEditor/modules/es/views/es.ToolbarView.js
@@ -79,7 +79,7 @@
8080 var toolDefintion = es.Tool.tools[ this.config[i].items[j] ];
8181 if ( toolDefintion ) {
8282 var tool = new toolDefintion.constructor(
83 - this, toolDefintion.name, toolDefintion.data
 83+ this, toolDefintion.name, toolDefintion.title, toolDefintion.data
8484 );
8585 this.tools.push( tool );
8686 $group.append( tool.$ );

Status & tagging log