File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
djangocms_alias/static/djangocms_alias/js Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11( function ( ) {
22
3- function processDataBridge ( data ) {
3+ const processDataBridge = function ( data ) {
44 let actionsPerformed = 0 ;
55 window . parent . console . log ( 'Processing data bridge:' , data ) ;
66 if ( data . replacedPlaceholder ) {
2929 const iframe = window . parent . document . querySelector ( '.cms-modal-frame > iframe' ) ;
3030 const { CMS } = window . parent ;
3131
32+ if ( ! iframe || ! CMS ) {
33+ return ;
34+ }
35+
3236 // Register the event handler in the capture phase to increase the chance it runs first
3337 iframe . addEventListener ( 'load' , function ( event ) {
3438 const iframeDocument = iframe . contentDocument || iframe . contentWindow . document ;
3539 const dataBridge = iframeDocument . body . querySelector ( 'script#data-bridge' ) ;
3640 if ( dataBridge ) {
3741 window . parent . console . log ( 'iframe loaded' , dataBridge ) ;
3842 try {
39- data = JSON . parse ( dataBridge . textContent ) ;
43+ const data = JSON . parse ( dataBridge . textContent ) ;
4044 if ( data . action === 'ALIAS_REPLACE' ) {
4145 event . stopPropagation ( ) ;
4246 dataBridge . parentNode . removeChild ( dataBridge ) ;
You can’t perform that action at this time.
0 commit comments