@@ -492,8 +492,9 @@ class CMSEditor {
492492 if ( script && script . textContent . length > 2 ) {
493493 this . CMS . API . Helpers . dataBridge = JSON . parse ( script . textContent ) ;
494494 } else {
495- const regex1 = / ^ \s * W i n d o w \. C M S \. A P I \. H e l p e r s \. d a t a B r i d g e \s = \s ( .* ?) ; $ / gmu. exec ( dom . innerHTML ) ;
496- const regex2 = / ^ \s * W i n d o w \. C M S \. A P I \. H e l p e r s \. d a t a B r i d g e \. s t r u c t u r e \s = \s ( .* ?) ; $ / gmu. exec ( dom . innerHTML ) ;
495+ const html = dom . innerHTML ;
496+ const regex1 = / ^ \s * W i n d o w \. C M S \. A P I \. H e l p e r s \. d a t a B r i d g e \s = \s ( .* ?) ; $ / gmu. exec ( html ) ;
497+ const regex2 = / ^ \s * W i n d o w \. C M S \. A P I \. H e l p e r s \. d a t a B r i d g e \. s t r u c t u r e \s = \s ( .* ?) ; $ / gmu. exec ( html ) ;
497498
498499 if ( regex1 && regex2 && this . CMS ) {
499500 this . CMS . API . Helpers . dataBridge = JSON . parse ( regex1 [ 1 ] ) ;
@@ -504,7 +505,9 @@ class CMSEditor {
504505 }
505506 }
506507 // Additional content for the page disrupts inline editing and needs to be removed
507- delete this . CMS . API . Helpers . dataBridge . structure ?. content ;
508+ if ( this . CMS . API . Helpers . dataBridge ?. structure ?. content ) {
509+ delete this . CMS . API . Helpers . dataBridge . structure . content ;
510+ }
508511 }
509512
510513 // CMS Editor: addPluginForm
@@ -565,7 +568,7 @@ class CMSEditor {
565568 // Hook into the django CMS dataBridge to get the details of the newly created or saved
566569 // plugin. For new plugins we need their id to get the content.
567570
568- this . processDataBridge ( form ) ;
571+ this . processDataBridge ( form . body ) ;
569572 // Needed to update StructureBoard
570573 if ( onSave && this . CMS . API . Helpers . dataBridge ) {
571574 onSave ( el , form , this . CMS . API . Helpers . dataBridge ) ;
0 commit comments