File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed
Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export default class ModificationsObserver extends Module {
2828 /**
2929 * Allows to temporary disable mutations handling
3030 */
31- private disabled : boolean ;
31+ private disabled = false ;
3232
3333 /**
3434 * Used to prevent several mutation callback execution
@@ -37,7 +37,10 @@ export default class ModificationsObserver extends Module {
3737 */
3838 private mutationDebouncer = _ . debounce ( ( ) => {
3939 this . updateNativeInputs ( ) ;
40- this . config . onChange ( this . Editor . API . methods ) ;
40+
41+ if ( this . config . onChange ) {
42+ this . config . onChange ( this . Editor . API . methods ) ;
43+ }
4144 } , ModificationsObserver . DebounceTimer ) ;
4245
4346 /**
@@ -116,7 +119,7 @@ export default class ModificationsObserver extends Module {
116119 * @param {MutationRecord[] } mutationList - list of mutations
117120 * @param {MutationObserver } observer - observer instance
118121 */
119- private mutationHandler ( mutationList : MutationRecord [ ] , observer ) : void {
122+ private mutationHandler ( mutationList : MutationRecord [ ] , observer : MutationObserver ) : void {
120123 /**
121124 * Skip mutations in stealth mode
122125 */
Original file line number Diff line number Diff line change @@ -36,16 +36,18 @@ export default class Saver extends Module {
3636 */
3737 ModificationsObserver . disable ( ) ;
3838
39- blocks . forEach ( ( block : Block ) => {
40- chainData . push ( this . getSavedData ( block ) ) ;
41- } ) ;
42-
43- const extractedData = await Promise . all ( chainData ) ;
44- const sanitizedData = await Sanitizer . sanitizeBlocks ( extractedData ) ;
39+ try {
40+ blocks . forEach ( ( block : Block ) => {
41+ chainData . push ( this . getSavedData ( block ) ) ;
42+ } ) ;
4543
46- ModificationsObserver . enable ( ) ;
44+ const extractedData = await Promise . all ( chainData ) ;
45+ const sanitizedData = await Sanitizer . sanitizeBlocks ( extractedData ) ;
4746
48- return this . makeOutput ( sanitizedData ) ;
47+ return this . makeOutput ( sanitizedData ) ;
48+ } finally {
49+ ModificationsObserver . enable ( ) ;
50+ }
4951 }
5052
5153 /**
You can’t perform that action at this time.
0 commit comments