File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ angular.module('ui.tinymce', [])
17
17
scope . $apply ( ) ;
18
18
}
19
19
} ;
20
+
20
21
// generate an ID if not present
21
22
if ( ! attrs . id ) {
22
23
attrs . $set ( 'id' , 'uiTinymce' + generatedIds ++ ) ;
@@ -27,6 +28,7 @@ angular.module('ui.tinymce', [])
27
28
} else {
28
29
expression = { } ;
29
30
}
31
+
30
32
options = {
31
33
// Update model when calling setContent (such as from the source editor popup)
32
34
setup : function ( ed ) {
@@ -65,7 +67,6 @@ angular.module('ui.tinymce', [])
65
67
tinymce . init ( options ) ;
66
68
} ) ;
67
69
68
-
69
70
ngModel . $render = function ( ) {
70
71
if ( ! tinyInstance ) {
71
72
tinyInstance = tinymce . get ( attrs . id ) ;
@@ -74,6 +75,14 @@ angular.module('ui.tinymce', [])
74
75
tinyInstance . setContent ( ngModel . $viewValue || '' ) ;
75
76
}
76
77
} ;
78
+
79
+ scope . $on ( '$destroy' , function ( ) {
80
+ if ( ! tinyInstance ) { tinyInstance = tinymce . get ( attrs . id ) ; }
81
+ if ( tinyInstance ) {
82
+ tinyInstance . remove ( ) ;
83
+ tinyInstance = null ;
84
+ }
85
+ } ) ;
77
86
}
78
87
} ;
79
88
} ] ) ;
You can’t perform that action at this time.
0 commit comments