@innovastudio/contentbuilder 1.5.28 → 1.5.30

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.28",
4
+ "version": "1.5.30",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -17314,19 +17314,27 @@ const renderSnippetPanel = (builder, snippetOpen) => {
17314
17314
  if (activeBuilderArea) {
17315
17315
  dom.addClass(activeBuilderArea, 'builder-active');
17316
17316
  }
17317
-
17318
- // destroy
17319
- if (builder.sortableOnCanvas) {
17320
- builder.sortableOnCanvas.forEach(obj => {
17321
- if (obj) {
17322
- obj.destroy();
17323
- }
17324
- });
17325
- builder.sortableOnCanvas = [];
17326
- }
17327
- if (builder.sortableOnPage) builder.sortableOnPage.destroy();
17328
- let dummies = builder.doc.querySelectorAll('.block-dummy');
17329
- dummies.forEach(elm => elm.parentNode.removeChild(elm));
17317
+ },
17318
+ onUnchoose: () => {
17319
+ setTimeout(() => {
17320
+ // Give time for onAdd to finish
17321
+ // Destroy placed in onUnchoose in case a snippet is just clicked (no drag/drop) so that onAdd is not triggered.
17322
+ // destroy
17323
+ if (builder.sortableOnCanvas) {
17324
+ builder.sortableOnCanvas.forEach(obj => {
17325
+ if (obj) {
17326
+ obj.destroy();
17327
+ }
17328
+ });
17329
+ builder.sortableOnCanvas = [];
17330
+ }
17331
+ if (builder.sortableOnPage) {
17332
+ builder.sortableOnPage.destroy();
17333
+ builder.sortableOnPage = null;
17334
+ }
17335
+ let dummies = builder.doc.querySelectorAll('.block-dummy');
17336
+ dummies.forEach(elm => elm.parentNode.removeChild(elm));
17337
+ }, 10);
17330
17338
  }
17331
17339
  });
17332
17340
  if (builder.opts.snippetList === '#divSnippetList') {
@@ -89159,7 +89167,10 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
89159
89167
  dummies.forEach(elm => elm.parentNode.removeChild(elm));
89160
89168
  this.sortableOnCanvas = [];
89161
89169
  }
89162
- if (this.sortableOnPage) this.sortableOnPage.destroy();
89170
+ if (this.sortableOnPage) {
89171
+ this.sortableOnPage.destroy();
89172
+ this.sortableOnPage = null;
89173
+ }
89163
89174
  }
89164
89175
  }
89165
89176
  });
@@ -92417,7 +92428,10 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
92417
92428
  dummies.forEach(elm => elm.parentNode.removeChild(elm));
92418
92429
  this.sortableOnCanvas = [];
92419
92430
  }
92420
- if (this.sortableOnPage) this.sortableOnPage.destroy();
92431
+ if (this.sortableOnPage) {
92432
+ this.sortableOnPage.destroy();
92433
+ this.sortableOnPage = null;
92434
+ }
92421
92435
  }
92422
92436
  });
92423
92437
  this.sortableOnCanvas.push(obj);
@@ -92493,7 +92507,10 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
92493
92507
  dummies.forEach(elm => elm.parentNode.removeChild(elm));
92494
92508
  this.sortableOnCanvas = [];
92495
92509
  }
92496
- if (this.sortableOnPage) this.sortableOnPage.destroy();
92510
+ if (this.sortableOnPage) {
92511
+ this.sortableOnPage.destroy();
92512
+ this.sortableOnPage = null;
92513
+ }
92497
92514
  return;
92498
92515
  }
92499
92516
  if (itemEl.getAttribute('data-id')) {
@@ -92647,7 +92664,10 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
92647
92664
  dummies.forEach(elm => elm.parentNode.removeChild(elm));
92648
92665
  this.sortableOnCanvas = [];
92649
92666
  }
92650
- if (this.sortableOnPage) this.sortableOnPage.destroy();
92667
+ if (this.sortableOnPage) {
92668
+ this.sortableOnPage.destroy();
92669
+ this.sortableOnPage = null;
92670
+ }
92651
92671
  }
92652
92672
  });
92653
92673
  }