@innovastudio/contentbuilder 1.5.173 → 1.5.175

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.173",
4
+ "version": "1.5.175",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "types": "index.d.ts",
@@ -14439,7 +14439,14 @@ class HtmlUtil {
14439
14439
  const cell = util.cellSelected();
14440
14440
  cell.innerHTML = html;
14441
14441
  let builderActive = this.builder.doc.querySelector('.builder-active');
14442
- if (builderActive) this.builder.applyBehaviorOn(builderActive);
14442
+ if (builderActive) {
14443
+ this.builder.applyBehaviorOn(builderActive);
14444
+
14445
+ // reinit after apply html
14446
+ if (this.builder.win.builderRuntime && builderActive.querySelector('[data-cb-type]')) {
14447
+ this.builder.win.builderRuntime.reinitialize(builderActive);
14448
+ }
14449
+ }
14443
14450
 
14444
14451
  //Trigger Change event
14445
14452
  this.builder.opts.onChange();
@@ -14458,7 +14465,14 @@ class HtmlUtil {
14458
14465
  if (!row) return;
14459
14466
  row.innerHTML = html;
14460
14467
  let builderActive = this.builder.doc.querySelector('.builder-active');
14461
- if (builderActive) this.builder.applyBehaviorOn(builderActive);
14468
+ if (builderActive) {
14469
+ this.builder.applyBehaviorOn(builderActive);
14470
+
14471
+ // reinit after apply html
14472
+ if (this.builder.win.builderRuntime && builderActive.querySelector('[data-cb-type]')) {
14473
+ this.builder.win.builderRuntime.reinitialize(builderActive);
14474
+ }
14475
+ }
14462
14476
 
14463
14477
  //Trigger Change event
14464
14478
  this.builder.opts.onChange();
@@ -14493,6 +14507,12 @@ class HtmlUtil {
14493
14507
  // let builderActive = this.builder.doc.querySelector('.builder-active');
14494
14508
  // if(builderActive) this.builder.applyBehaviorOn(builderActive);
14495
14509
  this.builder.applyBehaviorOn(area);
14510
+
14511
+ // reinit after apply html
14512
+ if (this.builder.win.builderRuntime && area.querySelector('[data-cb-type]')) {
14513
+ this.builder.win.builderRuntime.reinitialize(area);
14514
+ }
14515
+
14496
14516
  /*else {
14497
14517
  const builders = this.builder.doc.querySelectorAll(this.builder.opts.container);
14498
14518
  if(builders.length > 1) {
@@ -15112,13 +15132,18 @@ class HtmlUtil {
15112
15132
  elm.removeAttribute('data-item-id');
15113
15133
  });
15114
15134
  }
15135
+ // Cleanup data-item-id
15136
+ let elms = element.querySelectorAll('[data-item-id]');
15137
+ elms.forEach(elm => {
15138
+ elm.removeAttribute('data-item-id');
15139
+ });
15115
15140
 
15116
15141
  // Clean data-edit-id in editable area
15117
15142
  let editables = element.querySelectorAll('.edit');
15118
15143
  editables.forEach(area => {
15119
15144
  area.removeAttribute('data-edit-id');
15120
15145
  });
15121
- let elms = element.querySelectorAll('[data-scroll], [data-scroll-once]');
15146
+ elms = element.querySelectorAll('[data-scroll], [data-scroll-once]');
15122
15147
  elms.forEach(elm => {
15123
15148
  elm.removeAttribute('data-scroll');
15124
15149
  elm.removeAttribute('data-scroll-once');
@@ -51147,9 +51172,10 @@ class SettingsUIGenerator {
51147
51172
  generateForm(pluginName, element, onChange) {
51148
51173
  const plugin = this.runtime.getPlugin(pluginName);
51149
51174
  if (!plugin || !plugin.settings) {
51150
- console.warn(`Plugin "${pluginName}" has no settings schema`);
51175
+ // console.warn(`Plugin "${pluginName}" has no settings schema`);
51151
51176
  if (!plugin.editor) return this.createEmptyForm();
51152
51177
  }
51178
+ if (!plugin.settings) plugin.settings = {};
51153
51179
  const form = document.createElement('div');
51154
51180
  form.className = 'cb-settings-form';
51155
51181
 
@@ -51525,6 +51551,7 @@ class SettingsUIGenerator {
51525
51551
  */
51526
51552
  getCurrentValues(element, settings) {
51527
51553
  const values = {};
51554
+ if (!settings) return values;
51528
51555
  Object.keys(settings).forEach(key => {
51529
51556
  if (key.startsWith('_')) return;
51530
51557
  const attrName = 'data-cb-' + key.replace(/([A-Z])/g, '-$1').toLowerCase();
@@ -63580,6 +63607,14 @@ class ElementTool {
63580
63607
  let elementTool = this.elementTool;
63581
63608
  let elm = this.builder.activeElement;
63582
63609
  if (!elm) return;
63610
+ const editableArea = elm.closest('[data-edit-actions]');
63611
+ if (editableArea) {
63612
+ const editActions = editableArea.dataset.editActions || '';
63613
+ if (editActions.includes('no-add')) {
63614
+ // Adding elements is disabled
63615
+ return;
63616
+ }
63617
+ }
63583
63618
  if (elm.closest('.is-dock')) return;
63584
63619
  // if(elm.closest('[data-cb-type]')) return;
63585
63620