@innovastudio/contentbox 1.6.64 → 1.6.65

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.64",
4
+ "version": "1.6.65",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -146515,6 +146515,7 @@ class IframePanel {
146515
146515
 
146516
146516
  const timeoutHandler = async () => {
146517
146517
  await sleep(0.2);
146518
+ if (!document.body.contains(this.editPanel)) return; // in case of destroyed
146518
146519
 
146519
146520
  if (iframe.contentDocument.readyState === 'complete') {
146520
146521
  iframe.contentDocument.body.classList.add('iframe-body'); // add .iframe-body class that is required by box/flex.css
@@ -153958,39 +153959,46 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
153958
153959
  }
153959
153960
 
153960
153961
  destroy() {
153962
+ // let html = this.html();
153961
153963
  if (this.resizeObserver) this.resizeObserver.disconnect();
153962
- this.doc.removeEventListener('click', this.doDocumentClick, false);
153963
- if (this.iframe) document.removeEventListener('click', this.doDocumentClick, false);
153964
- this.doc.removeEventListener('click', this.doDocumentKeydown, false);
153965
- if (this.iframe) document.removeEventListener('click', this.doDocumentKeydown, false);
153966
- window.removeEventListener('scroll', this.doWindowScroll, false);
153967
- this.doc.removeEventListener('scroll', this.doAnimWheel, false);
153968
- this.win.removeEventListener('scroll', this.doAnimScroll, false);
153969
- this.win.removeEventListener('scroll', this.doScrollSync, false);
153970
- let html = this.html(); // this.builderStuff.parentNode.removeChild(this.builderStuff);
153964
+ const elmStyleEditPanel = document.querySelector('#_style_editpanel');
153965
+ if (elmStyleEditPanel) elmStyleEditPanel.remove(elmStyleEditPanel);
153966
+ const editPanel = document.querySelector('#editPanel');
153967
+ if (editPanel) editPanel.remove();
153968
+ const responsiveTool = document.querySelector('.is-responsive-tool');
153969
+ if (responsiveTool) responsiveTool.remove(); // this.builderStuff.parentNode.removeChild(this.builderStuff);
153971
153970
 
153972
153971
  this.builderStuff.innerHTML = '';
153973
- dom.removeClass(document.body, 'sidebar-active');
153972
+ document.body.classList.remove('sidebar-active');
153974
153973
  document.body.removeAttribute('data-skrollrr-off');
153975
153974
  document.body.style.overflowY = ''; // in iframe use, overflowY is set 'hidden'
153976
153975
  // Remove special css
153977
153976
 
153978
- const cbContentStyle = this.doc.querySelector('#_contentbox_css');
153979
- if (cbContentStyle) cbContentStyle.parentNode.removeChild(cbContentStyle);
153980
- const cbStuffStyle = document.querySelector('#_contentboxstuff_css');
153981
- if (cbStuffStyle) cbStuffStyle.parentNode.removeChild(cbStuffStyle); // Render html content
153982
-
153983
- let range = document.createRange();
153984
- const wrapper = this.wrapperEl;
153985
- wrapper.innerHTML = '';
153986
- wrapper.appendChild(range.createContextualFragment(html)); // We use createContextualFragment so that embedded javascript code (code block) will be executed
153977
+ if (this.doc) {
153978
+ const cbContentStyle = this.doc.querySelector('#_contentbox_css');
153979
+ if (cbContentStyle) cbContentStyle.remove(cbContentStyle);
153980
+ }
153987
153981
 
153988
- dom.removeClass(wrapper, 'is-edit');
153989
- this.editor.destroy();
153982
+ const cbStuffStyle = document.querySelector('#_contentboxstuff_css');
153983
+ if (cbStuffStyle) cbStuffStyle.remove(cbStuffStyle); // // Render html content
153984
+ // let range = document.createRange();
153985
+ // const wrapper = this.wrapperEl;
153986
+ // wrapper.innerHTML = '';
153987
+ // wrapper.appendChild(range.createContextualFragment(html)); // We use createContextualFragment so that embedded javascript code (code block) will be executed
153988
+ // wrapper.classList.remove('is-edit')
153989
+
153990
+ if (this.editor) this.editor.destroy();
153990
153991
  const panel = document.querySelector('#_newbox');
153991
153992
  if (panel) panel.parentNode.removeChild(panel);
153992
- document.body.classList.remove('controlpanel'); // Stop Pace
153993
- // Pace.stop();
153993
+ document.body.classList.remove('controlpanel');
153994
+ if (this.doc) this.doc.removeEventListener('click', this.doDocumentClick, false);
153995
+ if (this.iframe) document.removeEventListener('click', this.doDocumentClick, false);
153996
+ if (this.doc) this.doc.removeEventListener('click', this.doDocumentKeydown, false);
153997
+ if (this.iframe) document.removeEventListener('click', this.doDocumentKeydown, false);
153998
+ if (this.doc) this.doc.removeEventListener('scroll', this.doAnimWheel, false);
153999
+ if (this.win) this.win.removeEventListener('scroll', this.doAnimScroll, false);
154000
+ if (this.win) this.win.removeEventListener('scroll', this.doScrollSync, false);
154001
+ window.removeEventListener('scroll', this.doWindowScroll, false);
153994
154002
  }
153995
154003
 
153996
154004
  cleanupUnused() {