Index: trunk/extensions/VisualEditor/modules/es/tools/es.ListButtonTool.js |
— | — | @@ -1,14 +1,25 @@ |
2 | 2 | es.ListButtonTool = function( toolbar, name, data ) {
|
3 | 3 | es.ButtonTool.call( this, toolbar, name );
|
4 | 4 | this.data = data;
|
| 5 | + this.nodes = [];
|
5 | 6 | };
|
6 | 7 |
|
7 | 8 | es.ListButtonTool.prototype.onClick = function() {
|
| 9 | + /*
|
| 10 | + var parent;
|
| 11 | + for( var i = 0; i < this.nodes.length; i++ ) {
|
| 12 | + parent = this.nodes[i].getParent();
|
| 13 | + if ( parent.getElementType() !== 'listItem' ) {
|
| 14 | + console.log( this.nodes[i] );
|
| 15 | + }
|
| 16 | + }
|
| 17 | + */
|
8 | 18 | };
|
9 | 19 |
|
10 | 20 | es.ListButtonTool.prototype.updateState = function( annotations, nodes ) {
|
11 | 21 | // checks if all passed nodes are listItems of passed style
|
12 | 22 | function check( nodes, style ) {
|
| 23 | + var parent, styles;
|
13 | 24 | for( var i = 0; i < nodes.length; i++ ) {
|
14 | 25 | parent = nodes[i].getParent();
|
15 | 26 | if ( parent.getElementType() !== 'listItem' ) {
|
— | — | @@ -22,7 +33,8 @@ |
23 | 34 | return true;
|
24 | 35 | }
|
25 | 36 |
|
26 | | - if ( check( nodes, this.name ) ) {
|
| 37 | + this.nodes = nodes;
|
| 38 | + if ( check( this.nodes, this.name ) ) {
|
27 | 39 | this.$.addClass( 'es-toolbarButtonTool-down' );
|
28 | 40 | } else {
|
29 | 41 | this.$.removeClass( 'es-toolbarButtonTool-down' );
|