File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
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 ( ) ;
@@ -60,11 +63,15 @@ angular.module('ui.tinymce', [])
60
63
setTimeout ( function ( ) {
61
64
tinymce . init ( options ) ;
62
65
} ) ;
63
- ngModel . $render = function ( ) {
66
+
67
+
68
+ ngModel . $render = function ( ) {
64
69
if ( ! tinyInstance ) {
65
70
tinyInstance = tinymce . get ( attrs . id ) ;
66
71
}
67
- tinyInstance . setContent ( ngModel . $viewValue ) ;
72
+ if ( tinyInstance ) {
73
+ tinyInstance . setContent ( ngModel . $viewValue || '' ) ;
74
+ }
68
75
} ;
69
76
}
70
77
} ;
You can’t perform that action at this time.
0 commit comments