File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ angular.module('ui.tinymce', [])
38
38
} ,
39
39
// Update model when calling setContent (such as from the source editor popup)
40
40
setup : function ( ed ) {
41
+ ed . onInit . add ( function ( ed ) {
42
+ ngModel . $render ( ) ;
43
+ } ) ;
41
44
ed . onSetContent . add ( function ( ed , o ) {
42
45
if ( ed . isDirty ( ) ) {
43
46
ed . save ( ) ;
@@ -61,17 +64,15 @@ angular.module('ui.tinymce', [])
61
64
tinymce . init ( options ) ;
62
65
} ) ;
63
66
64
- var interval = setInterval ( function ( ) {
65
- tinyInstance = tinymce . get ( attrs . id ) ;
66
67
68
+ ngModel . $render = function ( ) {
69
+ if ( ! tinyInstance ) {
70
+ tinyInstance = tinymce . get ( attrs . id ) ;
71
+ }
67
72
if ( tinyInstance ) {
68
- clearInterval ( interval ) ;
69
-
70
- ngModel . $render = function ( ) {
71
- tinyInstance . setContent ( ngModel . $viewValue || '' ) ;
72
- } ;
73
+ tinyInstance . setContent ( ngModel . $viewValue || '' ) ;
73
74
}
74
- } , 0 ) ;
75
+ } ;
75
76
}
76
77
} ;
77
78
} ] ) ;
You can’t perform that action at this time.
0 commit comments