3
3
*/
4
4
angular . module ( 'ui.tinymce' , [ ] )
5
5
. value ( 'uiTinymceConfig' , { } )
6
- . directive ( 'uiTinymce' , [ 'uiTinymceConfig' , function ( uiTinymceConfig ) {
6
+ . directive ( 'uiTinymce' , [ 'uiTinymceConfig' , function ( $rootScope , uiTinymceConfig ) {
7
7
uiTinymceConfig = uiTinymceConfig || { } ;
8
8
var generatedIds = 0 ;
9
9
return {
@@ -13,7 +13,7 @@ angular.module('ui.tinymce', [])
13
13
var expression , options , tinyInstance ,
14
14
updateView = function ( ) {
15
15
ngModel . $setViewValue ( elm . val ( ) ) ;
16
- if ( ! scope . $root . $$phase ) {
16
+ if ( ! $rootScope . $$phase ) {
17
17
scope . $apply ( ) ;
18
18
}
19
19
} ;
@@ -37,34 +37,34 @@ angular.module('ui.tinymce', [])
37
37
38
38
options = {
39
39
// Update model when calling setContent (such as from the source editor popup)
40
- setup : function ( ed ) {
40
+ setup : function ( ed ) {
41
41
var args ;
42
42
ed . on ( 'init' , function ( args ) {
43
43
ngModel . $render ( ) ;
44
44
ngModel . $setPristine ( ) ;
45
45
} ) ;
46
46
// Update model on button click
47
- ed . on ( 'ExecCommand' , function ( e ) {
47
+ ed . on ( 'ExecCommand' , function ( e ) {
48
48
ed . save ( ) ;
49
49
updateView ( ) ;
50
50
} ) ;
51
51
// Update model on keypress
52
- ed . on ( 'KeyUp' , function ( e ) {
52
+ ed . on ( 'KeyUp' , function ( e ) {
53
53
ed . save ( ) ;
54
54
updateView ( ) ;
55
55
} ) ;
56
56
// Update model on change, i.e. copy/pasted text, plugins altering content
57
- ed . on ( 'SetContent' , function ( e ) {
57
+ ed . on ( 'SetContent' , function ( e ) {
58
58
if ( ! e . initial && ngModel . $viewValue !== e . content ) {
59
59
ed . save ( ) ;
60
60
updateView ( ) ;
61
61
}
62
62
} ) ;
63
63
ed . on ( 'blur' , function ( e ) {
64
- elm . blur ( ) ;
64
+ elm . blur ( ) ;
65
65
} ) ;
66
66
// Update model when an object has been resized (table, image)
67
- ed . on ( 'ObjectResized' , function ( e ) {
67
+ ed . on ( 'ObjectResized' , function ( e ) {
68
68
ed . save ( ) ;
69
69
updateView ( ) ;
70
70
} ) ;
@@ -77,7 +77,7 @@ angular.module('ui.tinymce', [])
77
77
} ;
78
78
// extend options with initial uiTinymceConfig and options from directive attribute value
79
79
angular . extend ( options , uiTinymceConfig , expression ) ;
80
- setTimeout ( function ( ) {
80
+ setTimeout ( function ( ) {
81
81
tinymce . init ( options ) ;
82
82
} ) ;
83
83
0 commit comments