@innovastudio/contentbuilder 1.5.166 → 1.5.167

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.5.166",
4
+ "version": "1.5.167",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "types": "index.d.ts",
@@ -52,7 +52,7 @@
52
52
  "sass": "^1.42.1",
53
53
  "sass-loader": "^12.1.0",
54
54
  "serve-static": "^1.14.1",
55
- "sharp": "^0.30.3",
55
+ "sharp": "^0.34.4",
56
56
  "style-loader": "^3.3.0",
57
57
  "webpack": "^5.53.0",
58
58
  "webpack-cli": "^4.8.0",
@@ -5544,13 +5544,24 @@ class Util {
5544
5544
  element.click();
5545
5545
  }
5546
5546
  }
5547
+ let editingInsidePlugin = false;
5548
+ let elm = this.builder.activeElement;
5549
+ const plugin = elm.closest('[data-cb-type]');
5550
+ const subblock = elm.closest('.is-subblock');
5551
+ if (plugin && subblock) {
5552
+ editingInsidePlugin = true;
5553
+ }
5547
5554
  if (mode === 'elm') {
5548
5555
  let elm = this.builder.activeElement; // See elementtool.js line 195-196. // document.querySelector('.elm-active');
5549
5556
  if (!elm) return;
5550
5557
  this.builder.uo.saveForUndo();
5551
5558
  let element = elm;
5552
5559
  let newelement;
5553
- if (!element.nextElementSibling && !element.closest('[data-subblock]')) {
5560
+ const plugin = element.closest('[data-cb-type]');
5561
+ if (plugin) {
5562
+ element.insertAdjacentHTML('afterend', html);
5563
+ newelement = element.nextElementSibling;
5564
+ } else if (!element.nextElementSibling && !element.closest('[data-subblock]')) {
5554
5565
  // active element is div.display > p.
5555
5566
  let activeCol = this.builder.activeCol;
5556
5567
  let current;
@@ -5604,7 +5615,7 @@ class Util {
5604
5615
  this.builder.opts.onRender();
5605
5616
 
5606
5617
  // Reinit after drag drop block
5607
- if (this.builder.win.builderRuntime) this.builder.win.builderRuntime.reinitialize();
5618
+ if (this.builder.win.builderRuntime && !editingInsidePlugin) this.builder.win.builderRuntime.reinitialize();
5608
5619
  setTimeout(() => {
5609
5620
  this.builder.makeSortable(this.builder.doc);
5610
5621
  }, 400);
@@ -15099,11 +15110,18 @@ class HtmlUtil {
15099
15110
  elm.removeAttribute('data-item-id');
15100
15111
  });
15101
15112
  }
15102
- const elms = element.querySelectorAll('[data-scroll], [data-scroll-once]');
15113
+ let elms = element.querySelectorAll('[data-scroll], [data-scroll-once]');
15103
15114
  elms.forEach(elm => {
15104
15115
  elm.removeAttribute('data-scroll');
15105
15116
  elm.removeAttribute('data-scroll-once');
15106
15117
  });
15118
+ elms = element.querySelectorAll('.elm-active, .icon-active');
15119
+ elms.forEach(elm => {
15120
+ elm.classList.remove('elm-active');
15121
+ elm.classList.remove('icon-active');
15122
+ });
15123
+ const oldEditables = element.querySelectorAll('[contenteditable="true"]');
15124
+ oldEditables.forEach(el => el.removeAttribute('contenteditable'));
15107
15125
  });
15108
15126
  html = '';
15109
15127
  if (multiple) {
@@ -53590,8 +53608,10 @@ class Element$1 {
53590
53608
  subblock = true;
53591
53609
  }
53592
53610
  }
53593
- if (elm.closest('[data-cb-type]')) {
53611
+ const plugin = elm.closest('[data-cb-type]');
53612
+ if (plugin) {
53594
53613
  customcode = true;
53614
+ subblock = elm.closest('.is-subblock');
53595
53615
  }
53596
53616
  if (!customcode && !noedit && !_protected || subblock) {
53597
53617
  //previously this is commented: && !noedit && !_protected
@@ -62739,7 +62759,15 @@ class ElementTool {
62739
62759
  if (elm.closest('.is-subblock')) {
62740
62760
  subblock = true;
62741
62761
  }
62742
-
62762
+ const plugin = elm.closest('[data-cb-type]');
62763
+ if (plugin && subblock) {
62764
+ elm.remove();
62765
+ this.elementTool.style.display = 'none';
62766
+ //Trigger Change event
62767
+ this.builder.opts.onChange();
62768
+ if (this.builder.onSelectChange) this.builder.onSelectChange();
62769
+ return;
62770
+ }
62743
62771
  /*
62744
62772
  if(dom.hasClass(elm.parentNode, 'cell-active') || elm.parentNode.hasAttribute('data-subblock')) {
62745
62773
  // Level 1
@@ -63098,7 +63126,7 @@ class ElementTool {
63098
63126
  subblock = true;
63099
63127
  }
63100
63128
  const plugin = elm.closest('[data-cb-type]');
63101
- if ((customcode || noedit || _protected) && !subblock) ; else if (plugin) {
63129
+ if ((customcode || noedit || _protected) && !subblock) ; else if (plugin && !subblock) {
63102
63130
  activeElement = plugin;
63103
63131
  } else {
63104
63132
  const tagName = elm.tagName.toLowerCase();