Index: trunk/extensions/VisualEditor/modules/es/tools/es.FormatDropdownTool.js |
— | — | @@ -33,8 +33,31 @@ |
34 | 34 | }
|
35 | 35 | };
|
36 | 36 |
|
37 | | -es.FormatDropdownTool.prototype.updateState = function( annotations ) {
|
38 | | - // ...
|
| 37 | +es.FormatDropdownTool.prototype.updateState = function( annotations, nodes ) {
|
| 38 | + var format = {
|
| 39 | + 'type': nodes[0].getElementType(),
|
| 40 | + 'attributes': nodes[0].element.attributes
|
| 41 | + };
|
| 42 | +
|
| 43 | + for( var i = 1; i < nodes.length; i++ ) {
|
| 44 | + if ( nodes[i].getElementType() != format.type
|
| 45 | + || !es.compareObjects( nodes[0].element.attributes, format.attributes ) ) {
|
| 46 | + format = null;
|
| 47 | + break;
|
| 48 | + }
|
| 49 | + }
|
| 50 | +
|
| 51 | + if ( format === null ) {
|
| 52 | + this.$select.val( null );
|
| 53 | + } else {
|
| 54 | + for ( var i = 0; i < this.formats.length; i++ ) {
|
| 55 | + if ( this.formats[i].type === format.type
|
| 56 | + && es.compareObjects( this.formats[i].attributes, format.attributes ) ) {
|
| 57 | + this.$select.val( i );
|
| 58 | + break;
|
| 59 | + }
|
| 60 | + }
|
| 61 | + }
|
39 | 62 | };
|
40 | 63 |
|
41 | 64 | es.Tool.tools.format = {
|