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
3333 * You have accompanying tests and all the tests are passing. See testing below.
3434 * 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
3535 * 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 )
3737
3838
3939## Testing
Original file line number Diff line number Diff line change @@ -56,6 +56,20 @@ angular.module('ui.tinymce', [])
5656
5757 angular . extend ( expression , scope . $eval ( attrs . uiTinymce ) ) ;
5858
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+
5973 var setupOptions = {
6074 // Update model when calling setContent
6175 // (such as from the source editor popup)
@@ -75,8 +89,7 @@ angular.module('ui.tinymce', [])
7589 // - the node has changed [NodeChange]
7690 // - an object has been resized (table, image) [ObjectResized]
7791 ed . on ( 'ExecCommand change NodeChange ObjectResized' , function ( ) {
78- ed . save ( ) ;
79- updateView ( ed ) ;
92+ debouncedUpdate ( ed ) ;
8093 } ) ;
8194
8295 ed . on ( 'blur' , function ( ) {
You can’t perform that action at this time.
0 commit comments