Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js |
— | — | @@ -132,29 +132,34 @@ |
133 | 133 | }, 0 ); |
134 | 134 | } |
135 | 135 | } ); |
136 | | - $window.resize( function() { |
137 | | - // Re-render when resizing horizontally |
138 | | - // TODO: Instead of re-rendering on every single 'resize' event wait till user is done with |
139 | | - // resizing - can be implemented with setTimeout |
140 | | - _this.hideCursor(); |
141 | | - _this.dimensions.height = $window.height(); |
142 | | - // XXX: This is a dirty hack! |
143 | | - _this.dimensions.toolbarHeight = $( '#es-toolbar' ).height(); |
144 | | - var width = _this.$.width(); |
145 | | - if ( _this.dimensions.width !== width ) { |
146 | | - _this.dimensions.width = width; |
147 | | - _this.documentView.renderContent(); |
148 | | - _this.emitUpdate( 25 ); |
149 | | - } |
150 | | - } ); |
151 | | - $window.scroll( function() { |
152 | | - _this.dimensions.scrollTop = $window.scrollTop(); |
153 | | - if ( _this.contextView ) { |
154 | | - if ( _this.currentSelection.getLength() && !_this.mouse.selectingMode ) { |
155 | | - _this.contextView.set(); |
156 | | - } else { |
157 | | - _this.contextView.clear(); |
| 136 | + $window.bind( { |
| 137 | + 'resize': function() { |
| 138 | + // Re-render when resizing horizontally |
| 139 | + // TODO: Instead of re-rendering on every single 'resize' event wait till user is done |
| 140 | + // with resizing - can be implemented with setTimeout |
| 141 | + _this.hideCursor(); |
| 142 | + _this.dimensions.height = $window.height(); |
| 143 | + // XXX: This is a dirty hack! |
| 144 | + _this.dimensions.toolbarHeight = $( '#es-toolbar' ).height(); |
| 145 | + var width = _this.$.width(); |
| 146 | + if ( _this.dimensions.width !== width ) { |
| 147 | + _this.dimensions.width = width; |
| 148 | + _this.documentView.renderContent(); |
| 149 | + _this.emitUpdate( 25 ); |
158 | 150 | } |
| 151 | + }, |
| 152 | + 'scroll': function() { |
| 153 | + _this.dimensions.scrollTop = $window.scrollTop(); |
| 154 | + if ( _this.contextView ) { |
| 155 | + if ( _this.currentSelection.getLength() && !_this.mouse.selectingMode ) { |
| 156 | + _this.contextView.set(); |
| 157 | + } else { |
| 158 | + _this.contextView.clear(); |
| 159 | + } |
| 160 | + } |
| 161 | + }, |
| 162 | + 'blur': function() { |
| 163 | + _this.keyboard.keys.shift = false; |
159 | 164 | } |
160 | 165 | } ); |
161 | 166 | |