This repository was archived by the owner on Sep 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ We are always looking for the quality contributions and will be happy to accept
33
33
* You have accompanying tests and all the tests are passing. See testing below.
34
34
* Your PR doesn't break the build; check the Travis-CI build status after opening a PR and push corrective commits if anything goes wrong
35
35
* You are using 2 space indentation
36
- * Your commits conform to the conventions established [ here] ( https://github.com/ajoslin /conventional-changelog/blob/master/conventions/angular .md )
36
+ * Your commits conform to the conventions established [ here] ( https://github.com/stevemao /conventional-changelog-angular /blob/master/convention .md )
37
37
38
38
39
39
## Testing
Original file line number Diff line number Diff line change @@ -56,6 +56,20 @@ angular.module('ui.tinymce', [])
56
56
57
57
angular . extend ( expression , scope . $eval ( attrs . uiTinymce ) ) ;
58
58
59
+ //Debounce update and save action
60
+ var debouncedUpdate = ( function ( debouncedUpdateDelay ) {
61
+ var debouncedUpdateTimer ;
62
+ return function ( ed ) {
63
+ $timeout . cancel ( debouncedUpdateTimer ) ;
64
+ debouncedUpdateTimer = $timeout ( function ( ) {
65
+ return ( function ( ed ) {
66
+ ed . save ( ) ;
67
+ updateView ( ed ) ;
68
+ } ) ( ed ) ;
69
+ } , debouncedUpdateDelay ) ;
70
+ } ;
71
+ } ) ( 400 ) ;
72
+
59
73
var setupOptions = {
60
74
// Update model when calling setContent
61
75
// (such as from the source editor popup)
@@ -75,8 +89,7 @@ angular.module('ui.tinymce', [])
75
89
// - the node has changed [NodeChange]
76
90
// - an object has been resized (table, image) [ObjectResized]
77
91
ed . on ( 'ExecCommand change NodeChange ObjectResized' , function ( ) {
78
- ed . save ( ) ;
79
- updateView ( ed ) ;
92
+ debouncedUpdate ( ed ) ;
80
93
} ) ;
81
94
82
95
ed . on ( 'blur' , function ( ) {
You can’t perform that action at this time.
0 commit comments