This repository was archived by the owner on Sep 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-26
lines changed Expand file tree Collapse file tree 1 file changed +13
-26
lines changed Original file line number Diff line number Diff line change @@ -15,40 +15,27 @@ angular.module('ui.tinymce', [])
15
15
attrs . $set ( 'id' , 'uiTinymce' + generatedIds ++ ) ;
16
16
}
17
17
options = {
18
- // Update model on button click
19
- onchange_callback : function ( inst ) {
20
- if ( inst . isDirty ( ) ) {
21
- inst . save ( ) ;
18
+ // Update model when calling setContent (such as from the source editor popup)
19
+ setup : function ( ed ) {
20
+ ed . on ( 'init' , function ( args ) {
21
+ ngModel . $render ( ) ;
22
+ } ) ;
23
+ // Update model on button click
24
+ ed . on ( 'ExecCommand' , function ( e ) {
25
+ ed . save ( ) ;
22
26
ngModel . $setViewValue ( elm . val ( ) ) ;
23
27
if ( ! scope . $$phase ) {
24
28
scope . $apply ( ) ;
25
29
}
26
- }
27
- } ,
28
- // Update model on keypress
29
- handle_event_callback : function ( e ) {
30
- if ( this . isDirty ( ) ) {
31
- this . save ( ) ;
30
+ } ) ;
31
+ // Update model on keypress
32
+ ed . on ( 'KeyUp' , function ( e ) {
33
+ console . log ( ed . isDirty ( ) ) ;
34
+ ed . save ( ) ;
32
35
ngModel . $setViewValue ( elm . val ( ) ) ;
33
36
if ( ! scope . $$phase ) {
34
37
scope . $apply ( ) ;
35
38
}
36
- }
37
- return true ; // Continue handling
38
- } ,
39
- // Update model when calling setContent (such as from the source editor popup)
40
- setup : function ( ed ) {
41
- ed . on ( 'init' , function ( args ) {
42
- ngModel . $render ( ) ;
43
- } ) ;
44
- ed . on ( 'change' , function ( e ) {
45
- if ( ed . isDirty ( ) ) {
46
- ed . save ( ) ;
47
- ngModel . $setViewValue ( elm . val ( ) ) ;
48
- if ( ! scope . $$phase ) {
49
- scope . $apply ( ) ;
50
- }
51
- }
52
39
} ) ;
53
40
} ,
54
41
mode : 'exact' ,
You can’t perform that action at this time.
0 commit comments