@@ -24,18 +24,12 @@ textAngular.directive("textAngular", [
24
24
_serial = ( attrs . serial ) ? attrs . serial : Math . floor ( Math . random ( ) * 10000000000000000 ) ,
25
25
_taExecCommand , _resizeMouseDown , _updateSelectedStylesTimeout ;
26
26
var _resizeTimeout ;
27
- var _resizeElement ;
28
27
29
28
scope . _name = ( attrs . name ) ? attrs . name : 'textAngularEditor' + _serial ;
30
29
31
30
var oneEvent = function ( _element , event , action ) {
32
31
$timeout ( function ( ) {
33
- // shim the .one till fixed
34
- var _func = function ( ) {
35
- _element . off ( event , _func ) ;
36
- action . apply ( this , arguments ) ;
37
- } ;
38
- _element . on ( event , _func ) ;
32
+ _element . one ( event , action ) ;
39
33
} , 100 ) ;
40
34
} ;
41
35
_taExecCommand = taExecCommand ( attrs . taDefaultWrap ) ;
@@ -131,8 +125,8 @@ textAngular.directive("textAngular", [
131
125
if ( _resizeTimeout ) $timeout . cancel ( _resizeTimeout ) ;
132
126
_resizeTimeout = $timeout ( function ( ) {
133
127
//console.log('resize', scope.displayElements.popover.css('display'));
134
- scope . reflowPopover ( _resizeElement ) ;
135
- scope . reflowResizeOverlay ( _resizeElement ) ;
128
+ scope . reflowPopover ( scope . resizeElement ) ;
129
+ scope . reflowResizeOverlay ( scope . resizeElement ) ;
136
130
} , 100 ) ;
137
131
}
138
132
} ;
@@ -211,7 +205,13 @@ textAngular.directive("textAngular", [
211
205
scope . showPopover = function ( _el ) {
212
206
scope . getScrollTop ( scope . displayElements . scrollWindow [ 0 ] , true ) ;
213
207
scope . displayElements . popover . css ( 'display' , 'block' ) ;
214
- _resizeElement = _el ;
208
+ // we must use a $timeout here, or the css change to the
209
+ // displayElements.resize.overlay will not take!!!
210
+ // WHY???
211
+ $timeout ( function ( ) {
212
+ scope . displayElements . resize . overlay . css ( 'display' , 'block' ) ;
213
+ } ) ;
214
+ scope . resizeElement = _el ;
215
215
scope . reflowPopover ( _el ) ;
216
216
$animate . addClass ( scope . displayElements . popover , 'in' ) ;
217
217
oneEvent ( $document . find ( 'body' ) , 'click keyup' , function ( ) { scope . hidePopover ( ) ; } ) ;
@@ -250,6 +250,7 @@ textAngular.directive("textAngular", [
250
250
scope . displayElements . popoverContainer . attr ( 'style' , '' ) ;
251
251
scope . displayElements . popoverContainer . attr ( 'class' , 'popover-content' ) ;
252
252
scope . displayElements . popover . removeClass ( 'in' ) ;
253
+ scope . displayElements . resize . overlay . css ( 'display' , 'none' ) ;
253
254
} ;
254
255
255
256
// setup the resize overlay
0 commit comments