Index: trunk/extensions/VisualEditor/modules/es/tools/es.FormatDropdownTool.js |
— | — | @@ -58,23 +58,6 @@ |
59 | 59 | 'type' : 'pre' |
60 | 60 | } |
61 | 61 | ] ); |
62 | | - |
63 | | - // Events |
64 | | - var _this = this; |
65 | | - this.$.bind( { |
66 | | - 'mousedown': function( e ) { |
67 | | - if ( e.button === 0 ) { |
68 | | - e.preventDefault(); |
69 | | - return false; |
70 | | - } |
71 | | - }, |
72 | | - 'mouseup': function( e ) { |
73 | | - if ( e.button === 0 ) { |
74 | | - _this.menuView.setPosition( es.Position.newFromElementPagePosition( _this.$ ) ); |
75 | | - _this.menuView.toggle(); |
76 | | - } |
77 | | - } |
78 | | - } ); |
79 | 62 | }; |
80 | 63 | |
81 | 64 | /* Methods */ |
— | — | @@ -107,7 +90,7 @@ |
108 | 91 | } |
109 | 92 | |
110 | 93 | if ( format === null ) { |
111 | | - this.$.html( ' ' ); |
| 94 | + this.$label.html( ' ' ); |
112 | 95 | } else { |
113 | 96 | var items = this.menuView.getItems(); |
114 | 97 | for ( i = 0; i < items.length; i++ ) { |
— | — | @@ -115,7 +98,7 @@ |
116 | 99 | format.type === items[i].type && |
117 | 100 | es.compareObjects( format.attributes, items[i].attributes ) |
118 | 101 | ) { |
119 | | - this.$.text( items[i].label ); |
| 102 | + this.$label.text( items[i].label ); |
120 | 103 | break; |
121 | 104 | } |
122 | 105 | } |
Index: trunk/extensions/VisualEditor/modules/es/tools/es.ButtonTool.js |
— | — | @@ -20,13 +20,13 @@ |
21 | 21 | var _this = this; |
22 | 22 | this.$.bind( { |
23 | 23 | 'mousedown': function( e ) { |
24 | | - if ( e.button === 0 ) { |
| 24 | + if ( e.which === 1 ) { |
25 | 25 | e.preventDefault(); |
26 | 26 | return false; |
27 | 27 | } |
28 | 28 | }, |
29 | 29 | 'mouseup': function ( e ) { |
30 | | - if ( e.button === 0 ) { |
| 30 | + if ( e.which === 1 ) { |
31 | 31 | _this.onClick( e ); |
32 | 32 | } |
33 | 33 | } |
Index: trunk/extensions/VisualEditor/modules/es/tools/es.DropdownTool.js |
— | — | @@ -18,17 +18,33 @@ |
19 | 19 | var _this = this; |
20 | 20 | this.menuView = new es.MenuView( items, function( item ) { |
21 | 21 | _this.onSelect( item ); |
22 | | - _this.$.text( item.label ); |
23 | | - } ); |
| 22 | + _this.$label.text( item.label ); |
| 23 | + }, this.$ ); |
| 24 | + this.$label = $( '<div class="es-toolbarDropdownTool-label"></div>' ).appendTo( this.$ ); |
24 | 25 | |
25 | 26 | // Events |
26 | 27 | $( document ) |
27 | 28 | .add( this.toolbar.surfaceView.$ ) |
28 | 29 | .mousedown( function( e ) { |
29 | | - if ( e.button === 0 ) { |
| 30 | + if ( e.which === 1 ) { |
30 | 31 | _this.menuView.hide(); |
31 | 32 | } |
32 | 33 | } ); |
| 34 | + this.$.bind( { |
| 35 | + 'mousedown': function( e ) { |
| 36 | + if ( e.which === 1 ) { |
| 37 | + e.preventDefault(); |
| 38 | + return false; |
| 39 | + } |
| 40 | + }, |
| 41 | + 'mouseup': function( e ) { |
| 42 | + // Don't respond to menu clicks |
| 43 | + var $item = $( e.target ).closest( '.es-menuView' ); |
| 44 | + if ( e.which === 1 && $item.length === 0 ) { |
| 45 | + _this.menuView.toggle(); |
| 46 | + } |
| 47 | + } |
| 48 | + } ); |
33 | 49 | |
34 | 50 | // DOM Changes |
35 | 51 | this.$.addClass( 'es-toolbarDropdownTool' ).addClass( 'es-toolbarDropdownTool-' + name ); |
Index: trunk/extensions/VisualEditor/modules/es/styles/es.ToolbarView.css |
— | — | @@ -22,7 +22,6 @@ |
23 | 23 | .es-toolbarButtonTool, |
24 | 24 | .es-toolbarDropdownTool { |
25 | 25 | display: inline-block; |
26 | | - padding: 0.25em; |
27 | 26 | border: solid 1px transparent; |
28 | 27 | border-radius: 0.125em; |
29 | 28 | -webkit-border-radius: 0.125em; |
— | — | @@ -32,6 +31,7 @@ |
33 | 32 | vertical-align: top; |
34 | 33 | } |
35 | 34 | .es-toolbarButtonTool { |
| 35 | + padding: 0.25em; |
36 | 36 | width: 22px; |
37 | 37 | height: 22px; |
38 | 38 | margin-right: 0.125em; |
— | — | @@ -98,11 +98,15 @@ |
99 | 99 | background-image: url(../images/clear.png); |
100 | 100 | } |
101 | 101 | .es-toolbarDropdownTool { |
| 102 | + position: relative; |
102 | 103 | border-color: #dddddd; |
103 | 104 | -webkit-border-radius: 0.25em; |
104 | 105 | -moz-border-radius: 0.25em; |
105 | 106 | -o-border-radius: 0.25em; |
106 | 107 | background-color: white; |
| 108 | +} |
| 109 | +.es-toolbarDropdownTool-label { |
| 110 | + padding: 0.25em; |
107 | 111 | font-size: 0.8em; |
108 | 112 | line-height: 24px; |
109 | 113 | padding-left: 0.75em; |
— | — | @@ -111,6 +115,10 @@ |
112 | 116 | background-position: 9em center; |
113 | 117 | background-repeat: no-repeat; |
114 | 118 | } |
| 119 | +.es-toolbarDropdownTool .es-menuView { |
| 120 | + left: -1px; |
| 121 | + top: -1px; |
| 122 | +} |
115 | 123 | .es-toolbarDropdownTool-format { |
116 | 124 | width: 8em; |
117 | 125 | } |
Index: trunk/extensions/VisualEditor/modules/es/views/es.ContextView.js |
— | — | @@ -58,13 +58,13 @@ |
59 | 59 | // Events |
60 | 60 | this.$icon.bind( { |
61 | 61 | 'mousedown': function( e ) { |
62 | | - if ( e.button === 0 ) { |
| 62 | + if ( e.which === 1 ) { |
63 | 63 | e.preventDefault(); |
64 | 64 | return false; |
65 | 65 | } |
66 | 66 | }, |
67 | 67 | 'mouseup': function( e ) { |
68 | | - if ( e.button === 0 ) { |
| 68 | + if ( e.which === 1 ) { |
69 | 69 | _this.menuView.toggle(); |
70 | 70 | } |
71 | 71 | } |
Index: trunk/extensions/VisualEditor/modules/es/views/es.MenuView.js |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | this.items = []; |
15 | 15 | this.autoNamedBreaks = 0; |
16 | 16 | this.callback = callback; |
17 | | - |
| 17 | + |
18 | 18 | // Items |
19 | 19 | if ( es.isArray( items ) ) { |
20 | 20 | for ( var i = 0; i < items.length; i++ ) { |
— | — | @@ -25,13 +25,13 @@ |
26 | 26 | var _this = this; |
27 | 27 | this.$.bind( { |
28 | 28 | 'mousedown': function( e ) { |
29 | | - if ( e.button === 0 ) { |
| 29 | + if ( e.which === 1 ) { |
30 | 30 | e.preventDefault(); |
31 | 31 | return false; |
32 | 32 | } |
33 | 33 | }, |
34 | 34 | 'mouseup': function( e ) { |
35 | | - if ( e.button === 0 ) { |
| 35 | + if ( e.which === 1 ) { |
36 | 36 | var $item = $( e.target ).closest( '.es-menuView-item' ); |
37 | 37 | if ( $item.length ) { |
38 | 38 | var name = $item.attr( 'rel' ); |