File tree Expand file tree Collapse file tree 1 file changed +35
-1
lines changed
core/src/main/resources/lib/form Expand file tree Collapse file tree 1 file changed +35
-1
lines changed Original file line number Diff line number Diff line change 117117 }
118118
119119 window . onbeforeunload = confirmExit ;
120- window . addEventListener ( "load" , initConfirm ) ;
120+
121+ function initWhenFormReady ( ) {
122+ const configForm =
123+ document . getElementsByName ( "config" ) [ 0 ] ||
124+ document . getElementsByName ( "viewConfig" ) [ 0 ] ;
125+
126+ if ( configForm ) {
127+ initConfirm ( ) ;
128+ return true ;
129+ }
130+ return false ;
131+ }
132+
133+ function initWhenReady ( ) {
134+ if ( initWhenFormReady ( ) ) {
135+ return ;
136+ }
137+
138+ const observer = new MutationObserver ( function ( ) {
139+ if ( initWhenFormReady ( ) ) {
140+ observer . disconnect ( ) ;
141+ }
142+ } ) ;
143+
144+ observer . observe ( document . body , {
145+ childList : true ,
146+ subtree : true ,
147+ } ) ;
148+ }
149+
150+ if ( document . readyState === "complete" ) {
151+ initWhenReady ( ) ;
152+ } else {
153+ window . addEventListener ( "load" , initWhenReady ) ;
154+ }
121155} ) ( ) ;
You can’t perform that action at this time.
0 commit comments