File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ export default {
3939 data () {
4040 return {
4141 imageEditor: null ,
42+ observer: null ,
4243 }
4344 },
4445
@@ -133,14 +134,31 @@ export default {
133134 )
134135 this .imageEditor .render ()
135136 window .addEventListener (' keydown' , this .handleKeydown , true )
136- window .addEventListener (' DOMNodeInserted' , this .handleSfxModal )
137+
138+ this .observer = new MutationObserver ((mutations ) => {
139+ mutations .forEach ((mutation ) => {
140+ if (mutation .type === ' childList' ) {
141+ mutation .addedNodes .forEach ((node ) => {
142+ if (node .classList .contains (' FIE_root' ) || node .classList .contains (' SfxModal-Wrapper' )) {
143+ emit (' viewer:trapElements:changed' , node)
144+ }
145+ })
146+ }
147+ })
148+ })
149+ // using body instead of the editor ref because save modal is not mounted in editor
150+ this .observer .observe (document .body , {
151+ childList: true ,
152+ subtree: true ,
153+ })
137154
138155 },
139156
140157 beforeDestroy () {
141158 if (this .imageEditor ) {
142159 this .imageEditor .terminate ()
143160 }
161+ this .observer .disconnect ()
144162 window .removeEventListener (' keydown' , this .handleKeydown , true )
145163 },
146164
You can’t perform that action at this time.
0 commit comments