@@ -39,7 +39,6 @@ export default {
3939	data () { 
4040		return  { 
4141			imageEditor:  null , 
42- 			observer:  null , 
4342		} 
4443	}, 
4544
@@ -134,31 +133,14 @@ export default {
134133		) 
135134		this .imageEditor .render () 
136135		window .addEventListener (' keydown' this .handleKeydown , true ) 
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'  
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- 		}) 
136+ 		window .addEventListener (' DOMNodeInserted' this .handleSfxModal ) 
154137
155138	}, 
156139
157140	beforeDestroy () { 
158141		if  (this .imageEditor ) { 
159142			this .imageEditor .terminate () 
160143		} 
161- 		this .observer .disconnect () 
162144		window .removeEventListener (' keydown' this .handleKeydown , true ) 
163145	}, 
164146
@@ -313,6 +295,17 @@ export default {
313295			} 
314296		}, 
315297
298+ 		/**  
299+ 		 * Watch out for Modal inject in document root 
300+ 		 * That way we can adjust the focusTrap 
301+ 		 * 
302+ 		 * @param  {Event}  event  Dom insertion event 
303+ 		 */  
304+ 		handleSfxModal (event ) { 
305+ 			if  (event .target ? .classList  &&  event .target .classList .contains (' SfxModal-Wrapper'  
306+ 				emit (' viewer:trapElements:changed' event .target ) 
307+ 			} 
308+ 		}, 
316309	}, 
317310} 
318311< / script> 
0 commit comments