@innovastudio/contentbuilder 1.5.58 → 1.5.60

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.58",
4
+ "version": "1.5.60",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "types": "index.d.ts",
@@ -1085,7 +1085,7 @@ class Snippets {
1085
1085
 
1086
1086
  if(bSnippet) {
1087
1087
  var quickadd = parent._cb.builderStuff.querySelector('.quickadd');
1088
- var mode = quickadd.getAttribute('data-mode');
1088
+ var mode = quickadd?quickadd.getAttribute('data-mode'):null;
1089
1089
  if(!mode) {
1090
1090
  // in case of using viewSnippets() to open the dialog (mode=null) => change to non snippet.
1091
1091
  html = '<div class="row">' +
@@ -62571,24 +62571,48 @@ class Pickr {
62571
62571
  return requestAnimationFrame(cb);
62572
62572
  }
62573
62573
 
62574
+ /*
62574
62575
  // Apply default color
62575
62576
  that.setColor(opt.default);
62576
62577
  that._rePositioningPicker();
62577
-
62578
- // Initialize color representation
62578
+ // Initialize color representation
62579
62579
  if (opt.defaultRepresentation) {
62580
- that._representation = opt.defaultRepresentation;
62581
- that.setColorRepresentation(that._representation);
62580
+ that._representation = opt.defaultRepresentation;
62581
+ that.setColorRepresentation(that._representation);
62582
62582
  }
62583
-
62584
- // Show pickr if locked
62583
+ // Show pickr if locked
62585
62584
  if (opt.showAlways) {
62586
- that.show();
62585
+ that.show();
62587
62586
  }
62588
-
62589
- // Initialization is done - pickr is usable, fire init event
62587
+ // Initialization is done - pickr is usable, fire init event
62590
62588
  that._initializingActive = false;
62591
62589
  that._emit('init');
62590
+ */
62591
+
62592
+ // Modified: fix performance issue
62593
+ new Promise(resolve => {
62594
+ // Apply default color
62595
+ that.setColor(opt.default);
62596
+ that._rePositioningPicker();
62597
+
62598
+ // Initialize color representation
62599
+ if (opt.defaultRepresentation) {
62600
+ that._representation = opt.defaultRepresentation;
62601
+ that.setColorRepresentation(that._representation);
62602
+ }
62603
+
62604
+ // Show pickr if locked
62605
+ if (opt.showAlways) {
62606
+ that.show();
62607
+ }
62608
+ resolve();
62609
+ }).then(() => {
62610
+ // Once all heavy work is done, perform any finalization here
62611
+
62612
+ // Initialization is done - pickr is usable, fire init event
62613
+ that._initializingActive = false;
62614
+ that._emit('init');
62615
+ });
62592
62616
  });
62593
62617
  }
62594
62618
 
@@ -64037,7 +64061,7 @@ class GradientPicker {
64037
64061
  // Delete custom gradient
64038
64062
  let btnsRemoveGrad = this.objStuff.querySelectorAll('.div-custom-gradients .is-elmgrad-remove');
64039
64063
  Array.prototype.forEach.call(btnsRemoveGrad, btnRemoveGrad => {
64040
- btnRemoveGrad.addEventListener('click', () => {
64064
+ btnRemoveGrad.addEventListener('click', e => {
64041
64065
  //Custom grad colors
64042
64066
  let customgradcolors = [];
64043
64067
  if (localStorage.getItem('_customgradcolors') !== null) {
@@ -64050,8 +64074,9 @@ class GradientPicker {
64050
64074
  }
64051
64075
  }
64052
64076
  localStorage.setItem('_customgradcolors', JSON.stringify(customgradcolors));
64053
- btnRemoveGrad.parentNode.parentNode.removeChild(btnRemoveGrad.parentNode);
64054
- return false;
64077
+ btnRemoveGrad.closest('.is-elmgrad-item').remove();
64078
+ e.preventDefault();
64079
+ e.stopImmediatePropagation();
64055
64080
  });
64056
64081
  });
64057
64082
  });
@@ -64156,7 +64181,7 @@ class GradientPicker {
64156
64181
  // Delete custom gradient
64157
64182
  let btnsRemoveGrad = this.objStuff.querySelectorAll('.div-custom-gradients .is-elmgrad-remove');
64158
64183
  Array.prototype.forEach.call(btnsRemoveGrad, btnRemoveGrad => {
64159
- btnRemoveGrad.addEventListener('click', () => {
64184
+ btnRemoveGrad.addEventListener('click', e => {
64160
64185
  //Custom grad colors
64161
64186
  let customgradcolors = [];
64162
64187
  if (localStorage.getItem('_customgradcolors') !== null) {
@@ -64169,8 +64194,9 @@ class GradientPicker {
64169
64194
  }
64170
64195
  }
64171
64196
  localStorage.setItem('_customgradcolors', JSON.stringify(customgradcolors));
64172
- btnRemoveGrad.parentNode.parentNode.removeChild(btnRemoveGrad.parentNode);
64173
- return false;
64197
+ btnRemoveGrad.closest('.is-elmgrad-item').remove();
64198
+ e.preventDefault();
64199
+ e.stopImmediatePropagation();
64174
64200
  });
64175
64201
  });
64176
64202
  const handleKeyDown = e => {
@@ -69078,11 +69104,16 @@ class Rte {
69078
69104
  // iframe.src = builder.opts.snippetData;
69079
69105
  // }
69080
69106
  const ifr = modal.querySelector('iframe');
69081
- var doc = ifr.contentWindow.document;
69082
- if (doc.body.innerHTML === '') {
69083
- doc.open();
69084
- doc.write(snippets.getSnippetsHtml());
69085
- doc.close();
69107
+ // var doc = ifr.contentWindow.document;
69108
+ // if(doc.body.innerHTML==='') {
69109
+ // doc.open();
69110
+ // doc.write(snippets.getSnippetsHtml());
69111
+ // doc.close();
69112
+ // }
69113
+
69114
+ if (!ifr.srcdoc) {
69115
+ // Set the HTML content directly using the srcdoc attribute
69116
+ ifr.srcdoc = snippets.getSnippetsHtml();
69086
69117
  }
69087
69118
  }
69088
69119
  openIcon(e) {