@innovastudio/contentbuilder 1.5.165 → 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.165",
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",
@@ -5135,6 +5135,7 @@ class Util {
5135
5135
  }
5136
5136
 
5137
5137
  hideModal(modal) {
5138
+ if (!modal) return;
5138
5139
  this.builder.doc.activeElement.blur();
5139
5140
  document.activeElement.blur();
5140
5141
  // this.builder.doc.body.focus();
@@ -5543,13 +5544,24 @@ class Util {
5543
5544
  element.click();
5544
5545
  }
5545
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
+ }
5546
5554
  if (mode === 'elm') {
5547
5555
  let elm = this.builder.activeElement; // See elementtool.js line 195-196. // document.querySelector('.elm-active');
5548
5556
  if (!elm) return;
5549
5557
  this.builder.uo.saveForUndo();
5550
5558
  let element = elm;
5551
5559
  let newelement;
5552
- 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]')) {
5553
5565
  // active element is div.display > p.
5554
5566
  let activeCol = this.builder.activeCol;
5555
5567
  let current;
@@ -5603,7 +5615,7 @@ class Util {
5603
5615
  this.builder.opts.onRender();
5604
5616
 
5605
5617
  // Reinit after drag drop block
5606
- if (this.builder.win.builderRuntime) this.builder.win.builderRuntime.reinitialize();
5618
+ if (this.builder.win.builderRuntime && !editingInsidePlugin) this.builder.win.builderRuntime.reinitialize();
5607
5619
  setTimeout(() => {
5608
5620
  this.builder.makeSortable(this.builder.doc);
5609
5621
  }, 400);
@@ -15098,11 +15110,18 @@ class HtmlUtil {
15098
15110
  elm.removeAttribute('data-item-id');
15099
15111
  });
15100
15112
  }
15101
- const elms = element.querySelectorAll('[data-scroll], [data-scroll-once]');
15113
+ let elms = element.querySelectorAll('[data-scroll], [data-scroll-once]');
15102
15114
  elms.forEach(elm => {
15103
15115
  elm.removeAttribute('data-scroll');
15104
15116
  elm.removeAttribute('data-scroll-once');
15105
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'));
15106
15125
  });
15107
15126
  html = '';
15108
15127
  if (multiple) {
@@ -53589,8 +53608,10 @@ class Element$1 {
53589
53608
  subblock = true;
53590
53609
  }
53591
53610
  }
53592
- if (elm.closest('[data-cb-type]')) {
53611
+ const plugin = elm.closest('[data-cb-type]');
53612
+ if (plugin) {
53593
53613
  customcode = true;
53614
+ subblock = elm.closest('.is-subblock');
53594
53615
  }
53595
53616
  if (!customcode && !noedit && !_protected || subblock) {
53596
53617
  //previously this is commented: && !noedit && !_protected
@@ -62738,7 +62759,15 @@ class ElementTool {
62738
62759
  if (elm.closest('.is-subblock')) {
62739
62760
  subblock = true;
62740
62761
  }
62741
-
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
+ }
62742
62771
  /*
62743
62772
  if(dom.hasClass(elm.parentNode, 'cell-active') || elm.parentNode.hasAttribute('data-subblock')) {
62744
62773
  // Level 1
@@ -63097,7 +63126,7 @@ class ElementTool {
63097
63126
  subblock = true;
63098
63127
  }
63099
63128
  const plugin = elm.closest('[data-cb-type]');
63100
- if ((customcode || noedit || _protected) && !subblock) ; else if (plugin) {
63129
+ if ((customcode || noedit || _protected) && !subblock) ; else if (plugin && !subblock) {
63101
63130
  activeElement = plugin;
63102
63131
  } else {
63103
63132
  const tagName = elm.tagName.toLowerCase();