r104956 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104955‎ | r104956 | r104957 >
Date:06:43, 2 December 2011
Author:inez
Status:resolved (Comments)
Tags:
Comment:
Initiali implementation of number and bullet buttons for lists.
Modified paths:
  • /trunk/extensions/VisualEditor/VisualEditor.php (modified) (history)
  • /trunk/extensions/VisualEditor/demo/index.html (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/styles/es.ToolbarView.css (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.ListButtonTool.js (added) (history)
  • /trunk/extensions/VisualEditor/modules/es/views/es.ToolbarView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/VisualEditor.php
@@ -106,6 +106,7 @@
107107 'es/tools/es.AnnotationButtonTool.js',
108108 'es/tools/es.ClearButtonTool.js',
109109 'es/tools/es.HistoryButtonTool.js',
 110+ 'es/tools/es.ListButtonTool.js',
110111 'es/tools/es.DropdownTool.js',
111112 'es/tools/es.FormatDropdownTool.js'
112113
Index: trunk/extensions/VisualEditor/demo/index.html
@@ -139,6 +139,7 @@
140140 <script src="../modules/es/tools/es.AnnotationButtonTool.js"></script>
141141 <script src="../modules/es/tools/es.ClearButtonTool.js"></script>
142142 <script src="../modules/es/tools/es.HistoryButtonTool.js"></script>
 143+ <script src="../modules/es/tools/es.ListButtonTool.js"></script>
143144 <script src="../modules/es/tools/es.DropdownTool.js"></script>
144145 <script src="../modules/es/tools/es.FormatDropdownTool.js"></script>
145146
Index: trunk/extensions/VisualEditor/modules/es/tools/es.ListButtonTool.js
@@ -0,0 +1,41 @@
 2+es.ListButtonTool = function( toolbar, name, data ) {
 3+ es.ButtonTool.call( this, toolbar, name );
 4+ this.data = data;
 5+};
 6+
 7+es.ListButtonTool.prototype.onClick = function() {
 8+};
 9+
 10+es.ListButtonTool.prototype.updateState = function( annotations, nodes ) {
 11+ function areSameTypeAndStyle( nodes, style ) {
 12+ for( var i = 0; i < nodes.length; i++ ) {
 13+ parent = nodes[i].getParent();
 14+ if ( parent.getElementType() !== 'listItem' ) {
 15+ return false;
 16+ }
 17+ styles = parent.getElementAttribute( 'styles' );
 18+ if ( styles[ styles.length - 1] !== style ) {
 19+ return false;
 20+ }
 21+ }
 22+ return true;
 23+ }
 24+
 25+ if ( areSameTypeAndStyle( nodes, this.name ) ) {
 26+ this.$.addClass( 'es-toolbarButtonTool-down' );
 27+ } else {
 28+ this.$.removeClass( 'es-toolbarButtonTool-down' );
 29+ }
 30+};
 31+
 32+es.Tool.tools.number = {
 33+ constructor: es.ListButtonTool,
 34+ name: 'number'
 35+};
 36+
 37+es.Tool.tools.bullet = {
 38+ constructor: es.ListButtonTool,
 39+ name: 'bullet'
 40+};
 41+
 42+es.extendClass( es.ListButtonTool, es.ButtonTool );
\ No newline at end of file
Index: trunk/extensions/VisualEditor/modules/es/styles/es.ToolbarView.css
@@ -73,10 +73,17 @@
7474 .es-toolbarButtonTool-clear:before {
7575 background-image: url(../images/clear.png);
7676 }
 77+.es-toolbarButtonTool-number:before {
 78+ background-image: url(../images/number.png);
 79+}
 80+.es-toolbarButtonTool-bullet:before {
 81+ background-image: url(../images/bullet.png);
 82+}
7783 .es-toolbarButtonTool-disabled.es-toolbarButtonTool-clear:before {
7884 -moz-opacity: 0.25;
7985 filter:alpha(opacity=25);
8086 opacity: 0.25;
 87+}
8188 .es-toolbarButtonTool-clear:before {
8289 background-image: url(../images/clear.png);
8390 }
Index: trunk/extensions/VisualEditor/modules/es/views/es.ToolbarView.js
@@ -49,7 +49,8 @@
5050
5151 this.config = config || [
5252 { 'name': 'textStyle', 'items' : [ 'bold', 'italic', 'link', 'clear', 'format' ] },
53 - { 'name': 'history', 'items' : [ 'undo', 'redo' ] }
 53+ { 'name': 'history', 'items' : [ 'undo', 'redo' ] },
 54+ { 'name': 'list', 'items' : [ 'number', 'bullet' ] }
5455 ];
5556 this.setup();
5657 };

Comments

#Comment by Johnduhart (talk | contribs)   02:57, 4 December 2011

Status & tagging log