@@ -91,7 +91,7 @@ textAngular.directive("textAngular", [
91
91
var _keydown , _keyup , _keypress , _mouseup , _focusin , _focusout ,
92
92
_originalContents , _toolbars ,
93
93
_serial = ( attrs . serial ) ? attrs . serial : Math . floor ( Math . random ( ) * 10000000000000000 ) ,
94
- _taExecCommand ;
94
+ _taExecCommand , _resizeMouseDown ;
95
95
96
96
scope . _name = ( attrs . name ) ? attrs . name : 'textAngularEditor' + _serial ;
97
97
@@ -232,7 +232,8 @@ textAngular.directive("textAngular", [
232
232
} ;
233
233
/* istanbul ignore next: pretty sure phantomjs won't test this */
234
234
scope . showResizeOverlay = function ( _el ) {
235
- var resizeMouseDown = function ( event ) {
235
+ var _body = $document . find ( 'body' ) ;
236
+ _resizeMouseDown = function ( event ) {
236
237
var startPosition = {
237
238
width : parseInt ( _el . attr ( 'width' ) ) ,
238
239
height : parseInt ( _el . attr ( 'height' ) ) ,
@@ -257,30 +258,33 @@ textAngular.directive("textAngular", [
257
258
pos . y = ratio > newRatio ? pos . x * ratio : pos . y ;
258
259
}
259
260
el = angular . element ( _el ) ;
261
+ console . log ( 'element' , pos , _el ) ;
260
262
el . attr ( 'height' , Math . max ( 0 , pos . y ) ) ;
261
263
el . attr ( 'width' , Math . max ( 0 , pos . x ) ) ;
262
264
263
265
// reflow the popover tooltip
264
266
scope . reflowResizeOverlay ( _el ) ;
265
267
} ;
266
- $document . find ( 'body' ) . on ( 'mousemove' , mousemove ) ;
267
- oneEvent ( $document . find ( 'body' ) , 'mouseup' , function ( event ) {
268
+ _body . on ( 'mousemove' , mousemove ) ;
269
+ oneEvent ( _body , 'mouseup' , function ( event ) {
268
270
event . preventDefault ( ) ;
269
271
event . stopPropagation ( ) ;
270
- $document . find ( 'body' ) . off ( 'mousemove' , mousemove ) ;
272
+ console . log ( 'Trigger Removal' ) ;
273
+ _body . off ( 'mousemove' , mousemove ) ;
271
274
scope . showPopover ( _el ) ;
272
275
} ) ;
273
276
event . stopPropagation ( ) ;
274
277
event . preventDefault ( ) ;
275
278
} ;
276
279
277
- scope . displayElements . resize . anchors [ 3 ] . on ( 'mousedown' , resizeMouseDown ) ;
280
+ scope . displayElements . resize . anchors [ 3 ] . on ( 'mousedown' , _resizeMouseDown ) ;
278
281
279
282
scope . reflowResizeOverlay ( _el ) ;
280
- oneEvent ( $document . find ( 'body' ) , 'click' , function ( ) { scope . hideResizeOverlay ( ) ; } ) ;
283
+ oneEvent ( _body , 'click' , function ( ) { scope . hideResizeOverlay ( ) ; } ) ;
281
284
} ;
282
285
/* istanbul ignore next: pretty sure phantomjs won't test this */
283
286
scope . hideResizeOverlay = function ( ) {
287
+ scope . displayElements . resize . anchors [ 3 ] . off ( 'mousedown' , _resizeMouseDown ) ;
284
288
scope . displayElements . resize . overlay . css ( 'display' , '' ) ;
285
289
} ;
286
290
0 commit comments