@innovastudio/contentbuilder 1.4.137 → 1.4.139

Sign up to get free protection for your applications and to get access to all the features.
@@ -702,11 +702,14 @@ class Util {
702
702
  const cell = this.cellSelected();
703
703
  let row;
704
704
  if (!cell) {
705
- // If no active cell, check if it is from .row-add-initial (empty info)
706
- row = this.builder.doc.querySelector('.row-active');
707
- if (!row) return;else {
708
- // Empty content will always use 'row' mode to insert block.
709
- mode = 'row';
705
+ let elm = this.builder.activeElement;
706
+ if (elm && elm.closest('.is-block')) ; else {
707
+ // If no active cell, check if it is from .row-add-initial (empty info)
708
+ row = this.builder.doc.querySelector('.row-active');
709
+ if (!row) return;else {
710
+ // Empty content will always use 'row' mode to insert block.
711
+ mode = 'row';
712
+ }
710
713
  }
711
714
  } else {
712
715
  row = cell.parentNode;
@@ -1853,9 +1856,9 @@ class Util {
1853
1856
  getUIStyles() {
1854
1857
  const dom = this.dom;
1855
1858
  const html = `
1856
- <input type="text" class="style-helper-input" style="display:none;">
1859
+ <input type="text" class="style-helper-input" id="__style_helper_input" style="display:none;">
1857
1860
  <button class="style-helper-button-classic classic" style="display:none;"><svg><use xlink:href="#ion-code-working"></use></svg></button>
1858
- <select class="style-helper-select" style="display:none;"><option value=""></option></select>
1861
+ <select class="style-helper-select" id="__style_helper_select" style="display:none;"><option value=""></option></select>
1859
1862
 
1860
1863
  <div class="style-helper modal-color"></div>
1861
1864
  <div class="style-helper modal-background"></div>
@@ -2172,12 +2175,12 @@ class Util {
2172
2175
  <li role="option" tabindex="0" data-provider="" data-font-family="" style="font-size:12px;padding:10px 7px;box-sizing:border-box;"><div></div>
2173
2176
  <span style="z-index:1;position: relative;pointer-events: none;">${this.out('None')}</span>
2174
2177
  </li>
2175
- <li role="option" tabindex="0" data-provider="" data-font-family="Arial, sans-serif"><div></div><img src="${path}arial.png"></li>
2176
- <li role="option" tabindex="0" data-provider="" data-font-family="courier"><div></div><img src="${path}courier.png"></li>
2177
- <li role="option" tabindex="0" data-provider="" data-font-family="Georgia, serif"><div></div><img src="${path}georgia.png"></li>
2178
- <li role="option" tabindex="0" data-provider="" data-font-family="monospace"><div></div><img src="${path}monospace.png"></li>
2179
- <li role="option" tabindex="0" data-provider="" data-font-family="sans-serif"><div></div><img src="${path}sans_serif.png"></li>
2180
- <li role="option" tabindex="0" data-provider="" data-font-family="serif"><div></div><img src="${path}serif.png"></li>
2178
+ <li role="option" tabindex="0" data-provider="" data-font-family="'Helvetica Neue', 'Arial Nova', 'Nimbus Sans', Arial, sans-serif"><div></div><img src="${path}arial.png"></li>
2179
+ <li role="option" tabindex="0" data-provider="" data-font-family="'Nimbus Mono PS', 'Courier New', monospace"><div></div><img src="${path}courier.png"></li>
2180
+ <li role="option" tabindex="0" data-provider="" data-font-family="Superclarendon, 'Bookman Old Style', 'URW Bookman', 'URW Bookman L', 'Georgia Pro', Georgia, serif"><div></div><img src="${path}georgia.png"></li>
2181
+ <li role="option" tabindex="0" data-provider="" data-font-family="ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace"><div></div><img src="${path}monospace.png"></li>
2182
+ <li role="option" tabindex="0" data-provider="" data-font-family="system-ui, sans-serif"><div></div><img src="${path}sans_serif.png"></li>
2183
+ <li role="option" tabindex="0" data-provider="" data-font-family="Charter, 'Bitstream Charter', 'Sitka Text', Cambria, serif"><div></div><img src="${path}serif.png"></li>
2181
2184
  <li role="option" tabindex="0" data-provider="google" data-font-family="Abel, sans-serif"><div></div><img src="${path}abel.png"></li>
2182
2185
  <li role="option" tabindex="0" data-provider="google" data-font-family="Abril Fatface"><div></div><img src="${path}abril_fatface.png"></li>
2183
2186
  <li role="option" tabindex="0" data-provider="google" data-font-family="Advent Pro, sans-serif" data-font-style="wght@100;200;300;400;500;600;700"><div></div><img src="${path}advent_pro.png"></li>
@@ -10210,7 +10213,7 @@ class HtmlUtil {
10210
10213
  */
10211
10214
  const html = `<div class="is-modal viewhtml" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
10212
10215
  <div class="is-modal-content">
10213
- <textarea class="tabSupport" style="width:100%;height:calc(100% - 50px);border:none;margin:0;box-sizing:border-box;"></textarea>
10216
+ <textarea class="tabSupport" id="__tabsupport" style="width:100%;height:calc(100% - 50px);border:none;margin:0;box-sizing:border-box;"></textarea>
10214
10217
  <div class="is-modal-footer" style="border-top:1px solid ${this.builder.styleSeparatorColor};width:100%;height:50px;position:absolute;left:0;bottom:0;overflow:hidden;text-align:right">
10215
10218
  <button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
10216
10219
  <button title="${util.out('Ok')}" class="input-ok classic-primary">${util.out('Ok')}</button>
@@ -10220,7 +10223,7 @@ class HtmlUtil {
10220
10223
 
10221
10224
  <div class="is-modal viewhtmlmonaco" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
10222
10225
  <div class="is-modal-content" style="width:${this.builder.blockCodeEditorWidth};max-width:${this.builder.blockCodeEditorMaxWidth};padding:0">
10223
- <textarea style="position:absolute;display:none;"></textarea>
10226
+ <textarea id="__viewhtmlmonaco" style="position:absolute;display:none;"></textarea>
10224
10227
  <div class="input-code-editor" style="width:100%;height:${this.builder.blockCodeEditorHeight};"></div>
10225
10228
  <div class="is-modal-footer" style="display:flex;justify-content:flex-end;border-top:1px solid ${this.builder.styleSeparatorColor};">
10226
10229
  <button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
@@ -10231,7 +10234,7 @@ class HtmlUtil {
10231
10234
 
10232
10235
  <div class="is-modal viewhtmlexternal" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
10233
10236
  <div class="is-modal-content" style="width:${this.builder.codeEditorWidth};max-width:${this.builder.codeEditorMaxWidth};padding:0">
10234
- <div class="input-code-editor" style="width:100%;height:${this.builder.codeEditorHeight};"></div>
10237
+ <div class="input-code-editor" id="__input_code_editor" style="width:100%;height:${this.builder.codeEditorHeight};"></div>
10235
10238
  <div class="is-modal-footer" style="display:flex;justify-content:flex-end;border-top:1px solid ${this.builder.styleSeparatorColor};">
10236
10239
  <button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
10237
10240
  <button title="${util.out('Ok')}" class="input-ok classic-primary">${util.out('Ok')}</button>
@@ -11063,6 +11066,23 @@ class HtmlUtil {
11063
11066
  dom$k.removeElements(elms);
11064
11067
  elms = tmp.querySelectorAll('.is-section-info');
11065
11068
  dom$k.removeElements(elms);
11069
+
11070
+ // freeform
11071
+ elms = tmp.querySelectorAll('.is-block .handle, .is-block .rotate-handle');
11072
+ dom$k.removeElements(elms);
11073
+ elms = tmp.querySelectorAll('.is-block');
11074
+ Array.prototype.forEach.call(elms, elm => {
11075
+ dom$k.removeClass(elm, 'active');
11076
+ dom$k.removeClass(elm, 'multi');
11077
+ dom$k.removeClass(elm, 'editable');
11078
+ dom$k.removeClass(elm, 'fluid');
11079
+ dom$k.removeClass(elm, 'cloned');
11080
+ elm.removeAttribute('data-fluid-val');
11081
+ elm.removeAttribute('data-fluid');
11082
+ });
11083
+ tmp.querySelectorAll('.is-block.clone').forEach(elm => elm.parentNode.removeChild(elm));
11084
+ // tmp.querySelectorAll('.is-block.cloned').forEach(elm=>elm.classList.remove('cloned'));
11085
+
11066
11086
  var html_content = '';
11067
11087
  var html_footer = '';
11068
11088
  var html_others = '';
@@ -11289,6 +11309,22 @@ class UndoRedo {
11289
11309
  dom.removeElements(tmp.querySelectorAll('.ovl'));
11290
11310
  dom.removeElements(tmp.querySelectorAll('.row-add-initial'));
11291
11311
 
11312
+ // freeform
11313
+ elms = tmp.querySelectorAll('.is-block .handle, .is-block .rotate-handle');
11314
+ dom.removeElements(elms);
11315
+ elms = tmp.querySelectorAll('.is-block');
11316
+ Array.prototype.forEach.call(elms, elm => {
11317
+ dom.removeClass(elm, 'active');
11318
+ dom.removeClass(elm, 'multi');
11319
+ dom.removeClass(elm, 'editable');
11320
+ dom.removeClass(elm, 'fluid');
11321
+ dom.removeClass(elm, 'cloned');
11322
+ elm.removeAttribute('data-fluid-val');
11323
+ elm.removeAttribute('data-fluid');
11324
+ });
11325
+ tmp.querySelectorAll('.is-block.clone').forEach(elm => elm.parentNode.removeChild(elm));
11326
+ // tmp.querySelectorAll('.is-block.cloned').forEach(elm=>elm.classList.remove('cloned'));
11327
+
11292
11328
  //ContentBox
11293
11329
  elms = tmp.querySelectorAll('.is-section-tool');
11294
11330
  dom.removeElements(elms);
@@ -11885,6 +11921,20 @@ const prepareSvgIcons = builder => {
11885
11921
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 15h2" /><path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z" /><path d="M11 12h6" /><path d="M13 9h4" />
11886
11922
  </symbol>
11887
11923
 
11924
+
11925
+ <symbol id="icon-stack-forward" viewBox="0 0 24 24" stroke-width="1.4" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
11926
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 5l-8 4l8 4l8 -4l-8 -4" fill="currentColor" /><path d="M10 12l-6 3l8 4l8 -4l-6 -3" />
11927
+ </symbol>
11928
+ <symbol id="icon-stack-backward" viewBox="0 0 24 24" stroke-width="1.4" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
11929
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14 12l6 -3l-8 -4l-8 4l6 3" /><path d="M10 12l-6 3l8 4l8 -4l-6 -3l-2 1z" fill="currentColor" />
11930
+ </symbol>
11931
+ <symbol id="icon-arrow-down" viewBox="0 0 24 24" stroke-width="1.4" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
11932
+ <path d="M12 5l0 14" /><path d="M18 13l-6 6" /><path d="M6 13l6 6" />
11933
+ </symbol>
11934
+ <symbol id="icon-arrow-up" viewBox="0 0 24 24" stroke-width="1.4" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
11935
+ <path d="M12 5l0 14" /><path d="M18 11l-6 -6" /><path d="M6 11l6 -6" />
11936
+ </symbol>
11937
+
11888
11938
  </defs>
11889
11939
  </svg>`;
11890
11940
  builder.dom.appendHtml(builder.builderStuff, html);
@@ -13398,9 +13448,10 @@ const renderQuickAdd = builder => {
13398
13448
  const ifr = modal.querySelector('iframe');
13399
13449
  var doc = ifr.contentWindow.document;
13400
13450
  if (doc.body.innerHTML === '') {
13401
- doc.open();
13402
- doc.write(snippets.getSnippetsHtml());
13403
- doc.close();
13451
+ // doc.open();
13452
+ // doc.write(snippets.getSnippetsHtml());
13453
+ // doc.close();
13454
+ ifr.srcdoc = snippets.getSnippetsHtml();
13404
13455
  }
13405
13456
 
13406
13457
  // quickadd.style.display = '';
@@ -18141,6 +18192,7 @@ const renderSnippetPanel = (builder, snippetOpen) => {
18141
18192
  // let safariAgent = false;
18142
18193
 
18143
18194
  let activeBuilderArea;
18195
+ let itemHeight;
18144
18196
  new Sortable(snippetlist, {
18145
18197
  // forceFallback: safariAgent,
18146
18198
  group: {
@@ -18151,7 +18203,7 @@ const renderSnippetPanel = (builder, snippetOpen) => {
18151
18203
 
18152
18204
  sort: false,
18153
18205
  animation: 150,
18154
- onChoose: () => {
18206
+ onChoose: evt => {
18155
18207
  // Adjust temmporary
18156
18208
  const newCss = `
18157
18209
  <style id="css-scale">
@@ -18163,6 +18215,7 @@ const renderSnippetPanel = (builder, snippetOpen) => {
18163
18215
  }
18164
18216
  </style>
18165
18217
  `;
18218
+ itemHeight = evt.item.offsetHeight;
18166
18219
  if (builder.iframe) {
18167
18220
  const oldCss = builder.contentStuff.querySelector('#css-scale');
18168
18221
  if (oldCss) oldCss.parentNode.removeChild(oldCss);
@@ -18174,6 +18227,16 @@ const renderSnippetPanel = (builder, snippetOpen) => {
18174
18227
  }
18175
18228
  builder.sectionDropSetup();
18176
18229
  },
18230
+ onClone: evt => {
18231
+ // fix broken image on cloned element
18232
+ var cloneEl = evt.clone;
18233
+ let img = cloneEl.querySelector('img');
18234
+ img.style.opacity = 0.0001;
18235
+ cloneEl.style.height = itemHeight + 'px';
18236
+ let timestamp = new Date().getTime();
18237
+ img.src = img.src + '?' + timestamp;
18238
+ img.style.opacity = '';
18239
+ },
18177
18240
  onMove: () => {
18178
18241
  let emptyinfo = builder.doc.querySelector('.row-add-initial'); // if there is empty info, remove it during snippet drag drop
18179
18242
  // if(emptyinfo) emptyinfo.parentNode.removeChild(emptyinfo);
@@ -18211,6 +18274,13 @@ const renderSnippetPanel = (builder, snippetOpen) => {
18211
18274
  if (activeBuilderArea) {
18212
18275
  dom.addClass(activeBuilderArea, 'builder-active');
18213
18276
  }
18277
+
18278
+ // destroy
18279
+ if (builder.sortableOnCanvas) builder.sortableOnCanvas.forEach(obj => {
18280
+ if (obj) {
18281
+ obj.destroy();
18282
+ }
18283
+ });
18214
18284
  if (builder.sortableOnPage) builder.sortableOnPage.destroy();
18215
18285
  }
18216
18286
  });
@@ -45567,10 +45637,10 @@ class Image$1 {
45567
45637
  </div>
45568
45638
 
45569
45639
  <label style="display:block;margin-top:14px;">
45570
- <input class="input-newwindow" type="checkbox" /> ${util.out('Open new window')}&nbsp;
45640
+ <input class="input-newwindow" id="__input_newwindow2" type="checkbox" /> ${util.out('Open new window')}&nbsp;
45571
45641
  </label>
45572
45642
  <label id="lblImageLinkOpenLightbox" style="${this.builder.useLightbox ? 'display:block' : 'display:none'};margin-top:5px;margin-bottom:14px;">
45573
- <input class="input-openlightbox" type="checkbox" /> ${util.out('Open in a lightbox (for image, video or Youtube)')}&nbsp;
45643
+ <input class="input-openlightbox" id="__input_openlightbox2" type="checkbox" /> ${util.out('Open in a lightbox (for image, video or Youtube)')}&nbsp;
45574
45644
  </label>
45575
45645
 
45576
45646
  <div style="text-align:right;margin-top:14px;">
@@ -45837,6 +45907,7 @@ class Image$1 {
45837
45907
 
45838
45908
  //Check if image is part of module snippet. If so, refresh the (active) module (hide imageTool). If not, refresh imageTool position
45839
45909
  this.refreshIfIsModule(img);
45910
+ this.startImageMonitor(img);
45840
45911
 
45841
45912
  //Trigger Change event
45842
45913
  this.builder.opts.onChange();
@@ -46371,6 +46442,30 @@ class Image$1 {
46371
46442
  this.builder.imgs = [];
46372
46443
  } //constructor
46373
46444
 
46445
+ startImageMonitor(target) {
46446
+ let observer;
46447
+ const config = {
46448
+ attributes: true
46449
+ };
46450
+ observer = new MutationObserver(mutations => {
46451
+ mutations.forEach(mutation => {
46452
+ if (mutation.attributeName === 'src') {
46453
+ // console.log('Image Changed:' + target.src);
46454
+
46455
+ if (this.builder.onImageSrcChange) this.builder.onImageSrcChange();
46456
+ stopImageMonitor(); // Stop the monitor when the image changes
46457
+ }
46458
+ });
46459
+ });
46460
+
46461
+ observer.observe(target, config);
46462
+ function stopImageMonitor() {
46463
+ if (observer) {
46464
+ observer.disconnect();
46465
+ // console.log('Monitor Stopped');
46466
+ }
46467
+ }
46468
+ }
46374
46469
  open() {
46375
46470
  const movControlBox = document.querySelector('.moveable-control-box');
46376
46471
  if (movControlBox) movControlBox.style.display = 'none'; //needed by Safari (prevent z-index problem)
@@ -48778,10 +48873,10 @@ class Hyperlink {
48778
48873
  </div>
48779
48874
  </div>
48780
48875
  <label style="display:block;margin-top:14px;">
48781
- <input class="input-newwindow" type="checkbox" /> ${util.out('Open new window')}&nbsp;
48876
+ <input class="input-newwindow" id="__input_newwindow" type="checkbox" /> ${util.out('Open new window')}&nbsp;
48782
48877
  </label>
48783
48878
  <label id="lblOpenLightbox" style="${this.builder.useLightbox ? 'display:block' : 'display:none'};margin-top:5px;margin-bottom:14px;">
48784
- <input class="input-openlightbox" type="checkbox" /> ${util.out('Open in a lightbox (for image, video or Youtube)')}&nbsp;
48879
+ <input class="input-openlightbox" id="__input_openlightbox" type="checkbox" /> ${util.out('Open in a lightbox (for image, video or Youtube)')}&nbsp;
48785
48880
  </label>
48786
48881
 
48787
48882
  <label id="lblCreateLinkText" for="inpCreateLinkText" style="margin-top:14px;display:block">${util.out('Text')}:</label>
@@ -50066,6 +50161,8 @@ class Module {
50066
50161
  });
50067
50162
  */
50068
50163
  if (module.getAttribute('data-panel') === 'side' && this.builder.controlPanel) ; else {
50164
+ let iframe = moduleModal.querySelector('iframe');
50165
+ iframe.style.opacity = 0.001;
50069
50166
  this.util.showModal(moduleModal, true, () => {
50070
50167
  if (btn) {
50071
50168
  btn.removeAttribute('data-focus');
@@ -50077,14 +50174,19 @@ class Module {
50077
50174
  // var d = new Date();
50078
50175
  // moduleModal.querySelector('iframe').src = this.builder.opts.modulePath + modulename + '.html?' + d.getTime(); //always refreshed
50079
50176
 
50080
- let iframe = moduleModal.querySelector('iframe');
50081
50177
  let result = await fetch(this.builder.opts.modulePath + modulename + '.html');
50082
50178
  result = await result.text();
50083
50179
  result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
50084
- let doc = iframe.contentWindow.document;
50085
- doc.open();
50086
- doc.write(result);
50087
- doc.close();
50180
+
50181
+ // let doc = iframe.contentWindow.document;
50182
+ // doc.open();
50183
+ // doc.write(result);
50184
+ // doc.close();
50185
+
50186
+ iframe.srcdoc = result;
50187
+ setTimeout(() => {
50188
+ iframe.style.opacity = '';
50189
+ }, 300);
50088
50190
  }
50089
50191
  }
50090
50192
  click(col) {
@@ -50312,8 +50414,8 @@ class Iframe {
50312
50414
 
50313
50415
  <div class="is-modal iframelink" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
50314
50416
  <div class="is-modal-content">
50315
- <input class="input-src" type="text" placeholder="Source" style="width:100%;margin-bottom:12px;"/>
50316
- <textarea class="input-embedcode" type="text" placeholder="Embed Code" style="width:100%;height:300px;margin-bottom:12px;display:none;"></textarea>
50417
+ <input class="input-src" id="__iframelink_input_src" type="text" placeholder="Source" style="width:100%;margin-bottom:12px;"/>
50418
+ <textarea class="input-embedcode" id="__iframelink_input_embedcode" type="text" placeholder="Embed Code" style="width:100%;height:300px;margin-bottom:12px;display:none;"></textarea>
50317
50419
  <div style="text-align:right">
50318
50420
  <button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
50319
50421
  <button title="${util.out('Ok')}" class="input-ok classic-primary">${util.out('Ok')}</button>
@@ -51022,13 +51124,13 @@ class Video {
51022
51124
  </div>
51023
51125
 
51024
51126
  <label style="display:block;margin-top:14px;">
51025
- <input class="input-video-controls" type="checkbox" /> ${util.out('Show Controls')}&nbsp;
51127
+ <input class="input-video-controls" id="__input_video_controls" type="checkbox" /> ${util.out('Show Controls')}&nbsp;
51026
51128
  </label>
51027
51129
  <label style="display:block;margin-top:5px;">
51028
- <input class="input-video-loop" type="checkbox" /> ${util.out('Loop')}&nbsp;
51130
+ <input class="input-video-loop" id="__input_video_loop" type="checkbox" /> ${util.out('Loop')}&nbsp;
51029
51131
  </label>
51030
51132
  <label style="display:block;margin-top:5px;">
51031
- <input class="input-video-autoplay" type="checkbox" /> ${util.out('Autoplay')}&nbsp;
51133
+ <input class="input-video-autoplay" id="__input_video_autoplay" type="checkbox" /> ${util.out('Autoplay')}&nbsp;
51032
51134
  </label>
51033
51135
 
51034
51136
  <div style="text-align:right;margin-top:14px;">
@@ -51862,7 +51964,7 @@ class ColorPicker {
51862
51964
  </div>
51863
51965
  <button class="is-color-preview" tabindex="0" style="outline:none;cursor:default;position:absolute;top:0;left:0;width:100%;height:100%;transition:none;"></button>
51864
51966
  </div>
51865
- <input class="input-text" type="text" style="width:209px;height:35px;margin-top:8px;font-size:13px;"/>
51967
+ <input class="input-text" id="{id}" type="text" style="width:209px;height:35px;margin-top:8px;font-size:13px;"/>
51866
51968
  <button title="${this.out('Apply')}" class="input-ok" style="height:35px;margin-top:8px;"><svg class="is-icon-flex"><use xlink:href="#icon-ok"></use></svg></use></svg></svg></button>
51867
51969
  </div>
51868
51970
  </div>`;
@@ -51893,7 +51995,7 @@ class ColorPicker {
51893
51995
  </div>
51894
51996
  <button class="is-color-preview" tabindex="0" style="outline:none;cursor:default;position:absolute;top:0;left:0;width:100%;height:100%;transition:none;"></button>
51895
51997
  </div>
51896
- <input class="input-text" type="text" style="width:209px;height:35px;margin-top:8px;font-size:13px;"/>
51998
+ <input class="input-text" id="{id}" type="text" style="width:209px;height:35px;margin-top:8px;font-size:13px;"/>
51897
51999
  <button title="${this.out('Apply')}" class="input-ok" style="height:35px;margin-top:8px;"><svg class="is-icon-flex"><use xlink:href="#icon-ok"></use></svg></use></svg></svg></button>
51898
52000
  </div>
51899
52001
 
@@ -51917,9 +52019,9 @@ class ColorPicker {
51917
52019
  let pickcolor;
51918
52020
  if (this.opts.renderOn !== '') {
51919
52021
  pickcolor = document.querySelector(this.opts.renderOn);
51920
- pickcolor.insertAdjacentHTML('beforeend', html);
52022
+ pickcolor.insertAdjacentHTML('beforeend', html.replace(/{id}/g, this.makeId()));
51921
52023
  } else {
51922
- objStuff.insertAdjacentHTML('beforeend', html_modal);
52024
+ objStuff.insertAdjacentHTML('beforeend', html_modal.replace(/{id}/g, this.makeId()));
51923
52025
  pickcolor = objStuff.querySelector('.is-modal.pickcolor');
51924
52026
  }
51925
52027
  objStuff.insertAdjacentHTML('beforeend', html_more);
@@ -52198,6 +52300,15 @@ class ColorPicker {
52198
52300
  });
52199
52301
  } //constructor
52200
52302
 
52303
+ makeId() {
52304
+ let text = '';
52305
+ let possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
52306
+ for (let i = 0; i < 2; i++) text += possible.charAt(Math.floor(Math.random() * possible.length));
52307
+ let text2 = '';
52308
+ let possible2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
52309
+ for (let i = 0; i < 5; i++) text2 += possible2.charAt(Math.floor(Math.random() * possible2.length));
52310
+ return text + text2;
52311
+ }
52201
52312
  out(s) {
52202
52313
  if (this.opts.lang) {
52203
52314
  let val = this.opts.lang[s];
@@ -52769,7 +52880,7 @@ class GradientPicker {
52769
52880
  <div>
52770
52881
  <button title="${this.out('Select Color')}" class="input-gradient-color1 is-btn-color" data-value="dark" style="border-right:none"></button>
52771
52882
  <button title="${this.out('Select Color')}" class="input-gradient-color2 is-btn-color" data-value="dark"></button>
52772
- <input type="text" class="input-gradient-deg" value="0" style="width:60px;height:35px;margin-left:7px;margin-right:5px;font-size:14px;"/> deg
52883
+ <input type="text" class="input-gradient-deg" id="{id}" value="0" style="width:60px;height:35px;margin-left:7px;margin-right:5px;font-size:14px;"/> deg
52773
52884
  </div>
52774
52885
  </div>
52775
52886
  <div class="is-settings" style="margin-bottom:0">
@@ -52779,7 +52890,7 @@ class GradientPicker {
52779
52890
  </div>
52780
52891
  </div>
52781
52892
  `;
52782
- objStuff.insertAdjacentHTML('beforeend', html);
52893
+ objStuff.insertAdjacentHTML('beforeend', html.replace(/{id}/g, this.makeId()));
52783
52894
  const pickGradient = objStuff.querySelector('.is-modal.pickgradientcolor');
52784
52895
  this.pickGradient = pickGradient;
52785
52896
  const setupTabKeys = div => {
@@ -53007,6 +53118,15 @@ class GradientPicker {
53007
53118
  });
53008
53119
  } //constructor
53009
53120
 
53121
+ makeId() {
53122
+ let text = '';
53123
+ let possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
53124
+ for (let i = 0; i < 2; i++) text += possible.charAt(Math.floor(Math.random() * possible.length));
53125
+ let text2 = '';
53126
+ let possible2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
53127
+ for (let i = 0; i < 5; i++) text2 += possible2.charAt(Math.floor(Math.random() * possible2.length));
53128
+ return text + text2;
53129
+ }
53010
53130
  out(s) {
53011
53131
  if (this.opts.lang) {
53012
53132
  let val = this.opts.lang[s];
@@ -53438,9 +53558,7 @@ class RowTool {
53438
53558
  <div class="div-colsperline" style="flex-direction:column">
53439
53559
  <label style="margin:20px 0 0;display:flex;flex-direction:column">
53440
53560
  <span style="margin:0 4px 3px 0">${util.out('Columns per Line')}:</span>
53441
-
53442
-
53443
- <select class="input-numofcols" style="width:50%;display:none">
53561
+ <select class="input-numofcols" id="__input_numofcols" style="width:50%;display:none">
53444
53562
  <option value="">Default</option>
53445
53563
  <option value="2">2 columns per row</option>
53446
53564
  <option value="3">3 columns per row</option>
@@ -60096,14 +60214,21 @@ class ElementTextStyles {
60096
60214
  });
60097
60215
  if (!this.builder.renderIframeLater) {
60098
60216
  let iframe = fontModal.querySelector('iframe');
60099
- let doc = iframe.contentWindow.document;
60100
- doc.open();
60217
+
60218
+ // let doc = iframe.contentWindow.document;
60219
+ // doc.open();
60220
+ // if(!this.builder.opts.emailMode) {
60221
+ // doc.write(this.util.getFontFamilyHTML(true));
60222
+ // } else {
60223
+ // doc.write(this.util.getFontFamilyEmail(true));
60224
+ // }
60225
+ // doc.close();
60226
+
60101
60227
  if (!this.builder.opts.emailMode) {
60102
- doc.write(this.util.getFontFamilyHTML(true));
60228
+ iframe.srcdoc = this.util.getFontFamilyHTML(true);
60103
60229
  } else {
60104
- doc.write(this.util.getFontFamilyEmail(true));
60230
+ iframe.srcdoc = this.util.getFontFamilyEmail(true);
60105
60231
  }
60106
- doc.close();
60107
60232
  }
60108
60233
  let btn = panelStuff.querySelector('.input-elm-fontfamily');
60109
60234
  btn.addEventListener('click', () => {
@@ -63041,7 +63166,7 @@ class Preferences {
63041
63166
  this.dom = dom;
63042
63167
  let htmlThemes = '';
63043
63168
  if (this.builder.themes) {
63044
- htmlThemes = '<div class="div-themes">';
63169
+ htmlThemes = '<div class="div-themes" style="margin-top:3px">';
63045
63170
  let n = 0;
63046
63171
  this.builder.themes.forEach(item => {
63047
63172
  if (item[1] === '') {
@@ -63065,7 +63190,7 @@ class Preferences {
63065
63190
  <div style="width:50%">
63066
63191
  <label id="divBuilderMode" style="display:block;margin-top:10px;margin-bottom:5px;">
63067
63192
  ${util.out('Builder Mode')}:&nbsp;
63068
- <select class="select-buildermode">
63193
+ <select class="select-buildermode" id="__select_builderode">
63069
63194
  <option value="">${util.out('Default')}</option>
63070
63195
  <option value="minimal">${util.out('Minimal')}</option>
63071
63196
  <option value="clean">${util.out('Clean')}</option>
@@ -63074,7 +63199,7 @@ class Preferences {
63074
63199
 
63075
63200
  <label id="divOutlineMode" style="display:block;margin-top:10px;margin-bottom:5px;">
63076
63201
  ${util.out('Outline Mode')}:&nbsp;
63077
- <select class="select-outlinemode">
63202
+ <select class="select-outlinemode" id="__select_outlinemode">
63078
63203
  <option value="">${util.out('Row & column')}</option>
63079
63204
  <option value="row">${util.out('Row only')}</option>
63080
63205
  </select>
@@ -63082,35 +63207,35 @@ class Preferences {
63082
63207
 
63083
63208
  <label style="display:block;margin-top:10px;margin-bottom:5px;">
63084
63209
  ${util.out('Outline Style')}:&nbsp;
63085
- <select class="select-outlinestyle">
63210
+ <select class="select-outlinestyle" id="__select_outlinestyle">>
63086
63211
  <option value="">${util.out('Colored')}</option>
63087
63212
  <option value="grayoutline">${util.out('Gray')}</option>
63088
63213
  </select>
63089
63214
  </label>
63090
63215
 
63091
63216
  <label style="display:block;margin-top:10px;margin-bottom:10px;">
63092
- <input class="input-hiderowcoloutline" type="checkbox" /> ${util.out('Hide Outline')}&nbsp;
63217
+ <input class="input-hiderowcoloutline" id="__input_hiderowcoloutline" type="checkbox" /> ${util.out('Hide Outline')}&nbsp;
63093
63218
  </label>
63094
63219
 
63095
63220
  <label id="divHideCellTool" style="display:block;margin-top:10px;margin-bottom:10px;">
63096
- <input class="input-hidecelltool" type="checkbox" /> ${util.out('Hide Column Tool')}&nbsp;
63221
+ <input class="input-hidecelltool" id="__input_hidecelltool" type="checkbox" /> ${util.out('Hide Column Tool')}&nbsp;
63097
63222
  </label>
63098
63223
 
63099
63224
 
63100
63225
  <label style="display:block;margin-top:10px;margin-bottom:10px;">
63101
- <input class="input-hidesnippetaddtool" type="checkbox" /> ${util.out('Hide Snippet (+) Tool')}&nbsp;
63226
+ <input class="input-hidesnippetaddtool" id="__input_hidesnippetaddtool" type="checkbox" /> ${util.out('Hide Snippet (+) Tool')}&nbsp;
63102
63227
  </label>
63103
63228
 
63104
63229
  <label style="display:block;margin-top:10px;margin-bottom:10px;">
63105
- <input class="input-hideelementtool" type="checkbox" /> ${util.out('Hide element tool')}&nbsp;
63230
+ <input class="input-hideelementtool" id="__input_hideelementtool" type="checkbox" /> ${util.out('Hide element tool')}&nbsp;
63106
63231
  </label>
63107
63232
 
63108
63233
  <label style="display:block;margin-top:10px;margin-bottom:10px;">
63109
- <input class="input-hideelementhighlight" type="checkbox" /> ${util.out('Hide element highlight')}&nbsp;
63234
+ <input class="input-hideelementhighlight" id="__input_hideelementhighlight" type="checkbox" /> ${util.out('Hide element highlight')}&nbsp;
63110
63235
  </label>
63111
63236
  <label style="display:block;margin-top:10px;margin-bottom:5px;">
63112
63237
  ${util.out('Row Tool Position')}:&nbsp;
63113
- <select class="select-rowtool">
63238
+ <select class="select-rowtool" id="__select_rowtool">
63114
63239
  <option value="right">${util.out('Right')}</option>
63115
63240
  <option value="left">${util.out('Left')}</option>
63116
63241
  </select>
@@ -63118,7 +63243,7 @@ class Preferences {
63118
63243
 
63119
63244
  <label style="display:block;margin-top:10px;margin-bottom:5px;">
63120
63245
  ${util.out('Tool Style')}:&nbsp;
63121
- <select class="select-toolstyle">
63246
+ <select class="select-toolstyle" id="__select_toolstyle">
63122
63247
  <option value="">${util.out('Colored')}</option>
63123
63248
  <option value="gray">${util.out('Mono')}</option>
63124
63249
  </select>
@@ -63128,12 +63253,12 @@ class Preferences {
63128
63253
  <div style="width:50%">
63129
63254
 
63130
63255
  <label class="option-opensnippets" style="display:block;margin-top:10px;margin-bottom:10px;">
63131
- <input class="input-opensnippets" type="checkbox" /> ${util.out('Open snippets sidebar on start')}&nbsp;
63256
+ <input class="input-opensnippets" id="__input_opensnippets" type="checkbox" /> ${util.out('Open snippets sidebar on start')}&nbsp;
63132
63257
  </label>
63133
63258
 
63134
63259
  <label style="display:${builder.opts.snippetList === '#divSnippetList' ? 'block' : 'none'};margin-top:10px;margin-bottom:5px;">
63135
63260
  ${util.out('Snippets sidebar visibility')}:&nbsp;
63136
- <select class="select-snippetssidebardisplay">
63261
+ <select class="select-snippetssidebardisplay" id="__select_snippetssidebardisplay">
63137
63262
  <option value="auto">${util.out('Auto')}</option>
63138
63263
  <option value="always">${util.out('Always Visible')}</option>
63139
63264
  </select>
@@ -63141,7 +63266,7 @@ class Preferences {
63141
63266
 
63142
63267
  <label style="display:block;margin-top:10px;margin-bottom:5px;">
63143
63268
  ${util.out('Toolbar visibility')}:&nbsp;
63144
- <select class="select-editingtoolbardisplay">
63269
+ <select class="select-editingtoolbardisplay" id="__select_editingtoolbardisplay">
63145
63270
  <option value="auto">${util.out('Auto')}</option>
63146
63271
  <option value="always">${util.out('Always Visible')}</option>
63147
63272
  </select>
@@ -63149,7 +63274,7 @@ class Preferences {
63149
63274
 
63150
63275
  <label style="${this.builder.isTouchSupport ? 'display:none;' : 'display:block;'}margin-top:10px;margin-bottom:5px;">
63151
63276
  ${util.out('Toolbar position')}:&nbsp;
63152
- <select class="select-editingtoolbar">
63277
+ <select class="select-editingtoolbar" id="__select_editingtoolbar">
63153
63278
  <option value="topfull">${util.out('Top (Full Width)')}</option>
63154
63279
  <option value="top">${util.out('Top')}</option>
63155
63280
  <option value="left">${util.out('Left')}</option>
@@ -63159,7 +63284,7 @@ class Preferences {
63159
63284
 
63160
63285
  <label style="display:block;margin-top:10px;margin-bottom:5px;">
63161
63286
  ${util.out('Paste result')}:&nbsp;
63162
- <select class="select-pasteresult">
63287
+ <select class="select-pasteresult" id="__select_pasteresult">
63163
63288
  <option value="html-without-styles">${util.out('HTML (without styles)')}</option>
63164
63289
  <option value="html">${util.out('HTML (with styles)')}</option>
63165
63290
  <option value="text">${util.out('Text only')}</option>
@@ -63168,7 +63293,7 @@ class Preferences {
63168
63293
 
63169
63294
  <label style="display:block;margin-top:10px;margin-bottom:5px;">
63170
63295
  ${util.out('HTML View')}:&nbsp;
63171
- <select class="select-htmlview">
63296
+ <select class="select-htmlview" id="__select_htmlview">
63172
63297
  <option value="shorten">${util.out('Shorten HTML')}</option>
63173
63298
  <option value="actual">${util.out('Actual')}</option>
63174
63299
  </select>
@@ -63177,8 +63302,8 @@ class Preferences {
63177
63302
  ${this.builder.themes ? `
63178
63303
  <label style="${this.builder.isTouchSupport ? 'display:none;' : 'display:block;'}margin-top:10px;margin-bottom:5px;">
63179
63304
  ${util.out('Theme')}:&nbsp;
63305
+ ${htmlThemes}
63180
63306
  </label>
63181
- ${htmlThemes}
63182
63307
  ` : ''}
63183
63308
 
63184
63309
  </div>
@@ -64831,14 +64956,19 @@ class Rte {
64831
64956
  // See preferences.js 284, contentbuilder.js 1800
64832
64957
  if (!this.builder.renderIframeLater) {
64833
64958
  let iframe = rteFontFamilyOptions.querySelector('iframe');
64834
- let doc = iframe.contentWindow.document;
64835
- doc.open();
64959
+ // let doc = iframe.contentWindow.document;
64960
+ // doc.open();
64961
+ // if(!this.builder.opts.emailMode) {
64962
+ // doc.write(util.getFontFamilyHTML());
64963
+ // } else {
64964
+ // doc.write(util.getFontFamilyEmail());
64965
+ // }
64966
+ // doc.close();
64836
64967
  if (!this.builder.opts.emailMode) {
64837
- doc.write(util.getFontFamilyHTML());
64968
+ iframe.srcdoc = util.getFontFamilyHTML();
64838
64969
  } else {
64839
- doc.write(util.getFontFamilyEmail());
64970
+ iframe.srcdoc = util.getFontFamilyEmail();
64840
64971
  }
64841
- doc.close();
64842
64972
  }
64843
64973
  let btnRteFontFamily = builderStuff.querySelectorAll('button.rte-fontfamily');
64844
64974
  btnRteFontFamily.forEach(btn => {
@@ -69278,7 +69408,18 @@ class Rte {
69278
69408
  }
69279
69409
  const viewportWidth = document.body.clientWidth; //window.innerWidth;
69280
69410
  const viewportHeight = window.innerHeight;
69281
- if (this.builder.opts.toolbar === 'left' || this.builder.opts.toolbar === 'right') {
69411
+ if (this.builder.opts.toolbar === 'right') {
69412
+ let h = this.rteTool.offsetHeight;
69413
+ let top = viewportHeight / 2 - h / 2;
69414
+ this.rteTool.style.left = '';
69415
+ this.rteTool.style.top = top + 'px';
69416
+
69417
+ // Element Toolbar
69418
+ h = this.elementRteTool.offsetHeight;
69419
+ top = viewportHeight / 2 - h / 2;
69420
+ this.elementRteTool.style.left = '';
69421
+ this.elementRteTool.style.top = top + 'px';
69422
+ } else if (this.builder.opts.toolbar === 'left') {
69282
69423
  let h = this.rteTool.offsetHeight;
69283
69424
  let top = viewportHeight / 2 - h / 2;
69284
69425
  this.rteTool.style.left = leftSidebarAdj2 + 'px';
@@ -71462,12 +71603,12 @@ class ContentStuff {
71462
71603
  }
71463
71604
  }
71464
71605
 
71465
-
71606
+ /*
71466
71607
  @media (min-width: 640px) {
71467
71608
  .is-builder > div {
71468
71609
  display:flex
71469
71610
  }
71470
- }
71611
+ }*/
71471
71612
 
71472
71613
  /* sortable */
71473
71614
  .sortable-drag {
@@ -71500,6 +71641,16 @@ class ContentStuff {
71500
71641
  transform-origin: top left;
71501
71642
  }
71502
71643
 
71644
+ /* Canvas Mode */
71645
+ .box-canvas > .sortable-ghost {
71646
+ background: transparent;
71647
+ outline: rgba(140, 140, 140, 0.5) 4px dashed !important;
71648
+ outline-offset: -15px;
71649
+ height:100% !important;
71650
+ transition: none !important;
71651
+ z-index:1;
71652
+ }
71653
+
71503
71654
  /* Moveable (Image resizer) */
71504
71655
  .moveable-control {
71505
71656
  border: none !important;
@@ -73044,10 +73195,14 @@ class LivePreview {
73044
73195
  let maxw = window.getComputedStyle(doc.querySelector('.is-builder')).getPropertyValue('max-width');
73045
73196
  if (!isNaN(parseInt(maxw))) maxwidth = maxw;
73046
73197
  let content = this.builder.html();
73047
- doc = iframe.contentWindow.document;
73048
- doc.open();
73049
- doc.write('<html>' + '<head>' + basehref + '<meta charset="utf-8">' + '<title></title>' + '<style>#_cbhtml > *:not(.is-lightbox) {display:none}</style>' + csslinks + (this.builder.useLightbox ? '<link href="' + this.builder.assetPath + 'scripts/lightbox/lightbox.css" rel="stylesheet">' : '') + '<style>' + '.slider-image { display:block !important; }' + '.container {margin:35px auto 0; max-width: ' + maxwidth + '; width:100%; padding:0 20px; box-sizing: border-box;}' + '</style>' + '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>' + jsincludes1 + '</head>' + '<body>' + '<div class="container preview">' + content + '</div>' + jsincludes2 + (this.builder.useLightbox ? '<script src="' + this.builder.assetPath + 'scripts/lightbox/lightbox.js"></script><script>window.lightbox.init();</script>' : '') + '</body>' + '</html>');
73050
- doc.close();
73198
+ let html = '<html>' + '<head>' + basehref + '<meta charset="utf-8">' + '<title></title>' + '<style>#_cbhtml > *:not(.is-lightbox) {display:none}</style>' + csslinks + (this.builder.useLightbox ? '<link href="' + this.builder.assetPath + 'scripts/lightbox/lightbox.css" rel="stylesheet">' : '') + '<style>' + '.slider-image { display:block !important; }' + '.container {margin:35px auto 0; max-width: ' + maxwidth + '; width:100%; padding:0 20px; box-sizing: border-box;}' + '</style>' + '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>' + jsincludes1 + '</head>' + '<body>' + '<div class="container preview">' + content + '</div>' + jsincludes2 + (this.builder.useLightbox ? '<script src="' + this.builder.assetPath + 'scripts/lightbox/lightbox.js"></script><script>window.lightbox.init();</script>' : '') + '</body>' + '</html>';
73199
+
73200
+ // doc = iframe.contentWindow.document;
73201
+ // doc.open();
73202
+ // doc.write(html);
73203
+ // doc.close();
73204
+
73205
+ iframe.srcdoc = html;
73051
73206
  }
73052
73207
  }
73053
73208
 
@@ -74209,7 +74364,7 @@ class Dictation {
74209
74364
  <button class="scope-image" title="${util.out('Image')}" data-value="image" style="display:none;margin-right:5px">${util.out('Image')}</button>
74210
74365
  </div>
74211
74366
  </div>
74212
- <textarea class="inp-command"></textarea>
74367
+ <textarea class="inp-command" id="__inp_command"></textarea>
74213
74368
  <div style="display:flex;">
74214
74369
  <button title="${util.out('Settings')}" class="cmd-command-config classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
74215
74370
  <svg class="is-icon-flex" style="width:15px;height:15px;flex:none;"><use xlink:href="#icon-settings"></use></svg>
@@ -74272,7 +74427,7 @@ class Dictation {
74272
74427
 
74273
74428
  <label class="label-input-autosend-command" style="margin:18px 0 0 0;display:flex;align-items:center;letter-spacing:0">
74274
74429
  <span>${util.out('Auto send command delay')}</soan>:
74275
- <input class="input-autosend-delay" style="width:60px;text-align:center;padding-left:0;height:33px;margin-right:3px;" type="text" value="4000"> <span>ms</span>
74430
+ <input class="input-autosend-delay" id="__input_autosend_delay" style="width:60px;text-align:center;padding-left:0;height:33px;margin-right:3px;" type="text" value="4000"> <span>ms</span>
74276
74431
  </label>
74277
74432
 
74278
74433
  <div class="command-settings-info" style="display:none"></div>
@@ -74280,7 +74435,7 @@ class Dictation {
74280
74435
  <label class="label-input-command-lang" style="display:none;flex-direction:column;letter-spacing:0;margin:18px 0 0 0;">
74281
74436
  <span>${util.out('Language')}:</span>
74282
74437
  <div style="display:flex; align-items: baseline;flex-direction: row;">
74283
- <input class="input-command-lang" style="width:70px;text-align:center;padding-left:0;height:33px;margin-top:5px;margin-right:10px" type="text" value="en-us">
74438
+ <input class="input-command-lang" id="__input_command_lang" style="width:70px;text-align:center;padding-left:0;height:33px;margin-top:5px;margin-right:10px" type="text" value="en-us">
74284
74439
  <span>(${util.out('BCP-47 format')})</span>
74285
74440
  </div>
74286
74441
  </label>
@@ -76434,7 +76589,7 @@ class ContentBuilder {
76434
76589
  let rowClicked;
76435
76590
  if (target.parentNode && target.parentNode.classList) rowClicked = target.parentNode.classList.contains('is-builder');
76436
76591
  let containerClicked = target.classList.contains('is-builder');
76437
- let a = target.closest('.is-builder');
76592
+ let a = target.closest('.is-builder') || target.closest('.is-block'); // freeform
76438
76593
  let p = target.closest('.is-subblock');
76439
76594
  let b = target.closest('.is-modal') || target.closest('.keep-selection');
76440
76595
  let c = target.closest('.is-side') || target.closest('.is-sidebar');
@@ -77033,7 +77188,8 @@ class ContentBuilder {
77033
77188
  if (oldCss) oldCss.parentNode.removeChild(oldCss);
77034
77189
  this.builderStuff.insertAdjacentHTML('afterbegin', newCss);
77035
77190
  }
77036
- this.sectionDropSetup(); // enable drop as section (ContentBox)
77191
+
77192
+ // this.sectionDropSetup(); // enable drop as section (ContentBox)
77037
77193
  },
77038
77194
 
77039
77195
  onStart: () => {
@@ -77044,7 +77200,7 @@ class ContentBuilder {
77044
77200
  onEnd: () => {
77045
77201
  this.util.checkEmpty(); // for multiple instances check
77046
77202
 
77047
- if (this.sortableOnPage) this.sortableOnPage.destroy(); // enable drop as section (ContentBox)
77203
+ // if(this.sortableOnPage) this.sortableOnPage.destroy(); // enable drop as section (ContentBox)
77048
77204
 
77049
77205
  if (this.controlPanel) {
77050
77206
  // && document.body.classList.contains('controlpanel') (already opens)
@@ -77173,9 +77329,17 @@ class ContentBuilder {
77173
77329
 
77174
77330
  // Hide element tool
77175
77331
  this.elmTool.hide();
77332
+ if (this.sortableOnCanvas) this.sortableOnCanvas.forEach(obj => {
77333
+ if (obj) {
77334
+ obj.destroy();
77335
+ }
77336
+ });
77337
+
77338
+ // if(this.sortableOnPage) this.sortableOnPage.destroy();
77176
77339
  }
77177
77340
  }
77178
77341
  });
77342
+
77179
77343
  this.sortableObjects.push(sortableObject);
77180
77344
  builder.setAttribute('data-sort', true);
77181
77345
  }
@@ -78355,7 +78519,7 @@ class ContentBuilder {
78355
78519
  //backward
78356
78520
  this.loadHtml(html);
78357
78521
  }
78358
- setUIColor(mode, csslink) {
78522
+ async setUIColor(mode, csslink) {
78359
78523
  // Get previous css
78360
78524
  let cssLink = document.querySelector('[data-cb-color]');
78361
78525
  if (cssLink) cssLink.setAttribute('data-cb-del', '');
@@ -78438,13 +78602,18 @@ class ContentBuilder {
78438
78602
 
78439
78603
  // if(this.opts.onThemeChange) this.opts.onThemeChange();
78440
78604
 
78441
- setTimeout(() => {
78442
- util.getUIStyles();
78443
- this.setUIColorRefresh();
78444
- if (this.opts.onThemeChange) this.opts.onThemeChange();
78445
- }, 1000);
78605
+ await this.delay(1000);
78606
+ // setTimeout(()=>{
78607
+ util.getUIStyles();
78608
+ this.setUIColorRefresh();
78609
+ if (this.opts.onThemeChange) this.opts.onThemeChange();
78610
+ // }, 1000);
78446
78611
  }
78447
78612
  }
78613
+
78614
+ async delay(ms) {
78615
+ return new Promise(resolve => setTimeout(resolve, ms));
78616
+ }
78448
78617
  setUIColorRefresh() {
78449
78618
  // All related with iframe style
78450
78619
 
@@ -78466,13 +78635,18 @@ class ContentBuilder {
78466
78635
  let iframeIcons = this.rte.rteIconOptions.querySelector('iframe');
78467
78636
  let doc3 = iframeIcons.contentWindow.document;
78468
78637
  if (doc1.body.innerHTML === '') {
78469
- doc1.open();
78638
+ // doc1.open();
78639
+ // if(!this.opts.emailMode) {
78640
+ // doc1.write(util.getFontFamilyHTML());
78641
+ // } else {
78642
+ // doc1.write(util.getFontFamilyEmail());
78643
+ // }
78644
+ // doc1.close();
78470
78645
  if (!this.opts.emailMode) {
78471
- doc1.write(util.getFontFamilyHTML());
78646
+ iframeRte.srcdoc = util.getFontFamilyHTML();
78472
78647
  } else {
78473
- doc1.write(util.getFontFamilyEmail());
78648
+ iframeRte.srcdoc = util.getFontFamilyEmail();
78474
78649
  }
78475
- doc1.close();
78476
78650
  } else {
78477
78651
  this.util.refreshFontFamilyStyle1();
78478
78652
  }
@@ -78481,21 +78655,27 @@ class ContentBuilder {
78481
78655
  let iframePanel = fontModal.querySelector('iframe');
78482
78656
  let doc2 = iframePanel.contentWindow.document;
78483
78657
  if (doc2.body.innerHTML === '') {
78484
- doc2.open();
78658
+ // doc2.open();
78659
+ // if(!this.opts.emailMode) {
78660
+ // doc2.write(util.getFontFamilyHTML(true));
78661
+ // } else {
78662
+ // doc2.write(util.getFontFamilyEmail(true));
78663
+ // }
78664
+ // doc2.close();
78485
78665
  if (!this.opts.emailMode) {
78486
- doc2.write(util.getFontFamilyHTML(true));
78666
+ iframePanel.srcdoc = util.getFontFamilyHTML(true);
78487
78667
  } else {
78488
- doc2.write(util.getFontFamilyEmail(true));
78668
+ iframePanel.srcdoc = util.getFontFamilyEmail(true);
78489
78669
  }
78490
- doc2.close();
78491
78670
  } else {
78492
78671
  this.util.refreshFontFamilyStyle2();
78493
78672
  }
78494
78673
  }
78495
78674
  if (doc3.body.innerHTML === '') {
78496
- doc3.open();
78497
- doc3.write(this.rte.getIconsHTML());
78498
- doc3.close();
78675
+ // doc3.open();
78676
+ // doc3.write(this.rte.getIconsHTML());
78677
+ // doc3.close();
78678
+ iframeIcons.srcdoc = this.rte.getIconsHTML();
78499
78679
  } else {
78500
78680
  this.rte.refreshIconsStyle();
78501
78681
  }
@@ -79800,6 +79980,164 @@ class ContentBuilder {
79800
79980
  if (this.page) {
79801
79981
  if (this.page !== '.is-wrapper') return; // only for ContentBox
79802
79982
  const wrapper = this.doc.querySelector(this.page);
79983
+ this.sortableOnCanvas = [];
79984
+ const sections = wrapper.querySelectorAll('.is-box.box-canvas');
79985
+ sections.forEach(section => {
79986
+ const obj = new Sortable(section, {
79987
+ scroll: true,
79988
+ group: 'shared',
79989
+ direction: 'horizontal',
79990
+ animation: 150,
79991
+ sort: true,
79992
+ onAdd: evt => {
79993
+ let itemEl = evt.item;
79994
+ if (itemEl.getAttribute('data-id')) {
79995
+ // If has data-id attribute, the dropped item is from snippet panel (snippetpanel.js)
79996
+
79997
+ let snippetid = itemEl.getAttribute('data-id');
79998
+ let lastBlock;
79999
+ let elements = Array.from(section.querySelectorAll('.is-block')).filter(elm => !elm.parentNode.classList.contains('is-block')); // exclude child blocks
80000
+ if (elements.length > 0) {
80001
+ lastBlock = elements[elements.length - 1];
80002
+ }
80003
+
80004
+ // snippetJSON is snippet's JSON (from assets/minimalist-blocks/content.js) that store all snippets' html
80005
+ const result = this.opts.snippetJSON.snippets.filter(item => {
80006
+ if (item.id + '' === snippetid) return item;else return false;
80007
+ });
80008
+ var html = result[0].html;
80009
+ var noedit = result[0].noedit;
80010
+ var bSnippet;
80011
+ if (html.indexOf('"row') === -1) {
80012
+ bSnippet = true; // Just snippet (without row/column grid)
80013
+ } else {
80014
+ bSnippet = false; // Snippet is wrapped in row/colum
80015
+ }
80016
+
80017
+ if (this.opts.emailMode) bSnippet = false;
80018
+
80019
+ // Convert snippet into your defined 12 columns grid
80020
+ var rowClass = this.opts.row; //row
80021
+ var colClass = this.opts.cols; //['col s1', 'col s2', 'col s3', 'col s4', 'col s5', 'col s6', 'col s7', 'col s8', 'col s9', 'col s10', 'col s11', 'col s12']
80022
+ if (rowClass !== '' && colClass.length === 12) {
80023
+ // html = html.replace(new RegExp('row clearfix', 'g'), rowClass);
80024
+ html = html.replace(new RegExp('row clearfix', 'g'), 'row'); // backward
80025
+ html = html.replace(new RegExp('"row', 'g'), '"' + rowClass);
80026
+ html = html.replace(new RegExp('column full', 'g'), colClass[11]);
80027
+ html = html.replace(new RegExp('column half', 'g'), colClass[5]);
80028
+ html = html.replace(new RegExp('column third', 'g'), colClass[3]);
80029
+ html = html.replace(new RegExp('column fourth', 'g'), colClass[2]);
80030
+ html = html.replace(new RegExp('column fifth', 'g'), colClass[1]);
80031
+ html = html.replace(new RegExp('column sixth', 'g'), colClass[1]);
80032
+ html = html.replace(new RegExp('column two-third', 'g'), colClass[7]);
80033
+ html = html.replace(new RegExp('column two-fourth', 'g'), colClass[8]);
80034
+ html = html.replace(new RegExp('column two-fifth', 'g'), colClass[9]);
80035
+ html = html.replace(new RegExp('column two-sixth', 'g'), colClass[9]);
80036
+ }
80037
+ html = html.replace(/{id}/g, this.util.makeId());
80038
+ if (this.opts.onAdd) {
80039
+ html = this.opts.onAdd(html);
80040
+ }
80041
+ if (this.opts.snippetPathReplace.length > 0) {
80042
+ // try {
80043
+ if (this.opts.snippetPathReplace[0] !== '') {
80044
+ var regex = new RegExp(this.opts.snippetPathReplace[0], 'g');
80045
+ html = html.replace(regex, this.opts.snippetPathReplace[1]);
80046
+ var string1 = this.opts.snippetPathReplace[0].replace(/\//g, '%2F');
80047
+ var string2 = this.opts.snippetPathReplace[1].replace(/\//g, '%2F');
80048
+ var regex2 = new RegExp(string1, 'g');
80049
+ html = html.replace(regex2, string2);
80050
+ }
80051
+ // } catch (e) { 1; }
80052
+ }
80053
+
80054
+ if (bSnippet) {
80055
+ // Just snippet (without row/column grid), ex. buttons, line, social, video, map.
80056
+ // Can be inserted after current row, column (cell), element, or last row.
80057
+
80058
+ html = `<div class="${this.opts.row}"><div class="${this.opts.cols[this.opts.cols.length - 1]}"${noedit ? ' data-noedit' : ''}>${html}</div></div>`;
80059
+
80060
+ // Clean snippet from sortable related code
80061
+ itemEl.removeAttribute('draggable');
80062
+ this.dom.removeClass(itemEl, 'snippet-item');
80063
+ const blockTemplate = `
80064
+ <div class="is-block block-fixed" style="top: 20%; left: 20%; width: 800px;">
80065
+ <div class="is-container container-new leading-12 size-17">
80066
+ [%CONTENT%]
80067
+ </div>
80068
+ </div>
80069
+ `;
80070
+ itemEl.outerHTML = blockTemplate.replace('[%CONTENT%]', html);
80071
+ } else {
80072
+ // Snippet is wrapped in row/colum (may contain custom code or has [data-html] attribute)
80073
+ // Can only be inserted after current row or last row (not on column or element).
80074
+
80075
+ let snippet = this.dom.createElement('div');
80076
+ snippet.innerHTML = html;
80077
+ let blocks = snippet.querySelectorAll('[data-html]');
80078
+ Array.prototype.forEach.call(blocks, block => {
80079
+ // Render custom code block
80080
+ html = decodeURIComponent(block.getAttribute('data-html'));
80081
+ html = html.replace(/{id}/g, this.util.makeId());
80082
+ html = html.replace(/<script>/g, `${this.nonce ? `<script nonce="${this.nonce}">` : '<script>'}`);
80083
+ for (var i = 1; i <= 20; i++) {
80084
+ html = html.replace('[%HTML' + i + '%]', block.getAttribute('data-html-' + i) === undefined ? '' : decodeURIComponent(block.getAttribute('data-html-' + i))); //render editable area
80085
+ }
80086
+
80087
+ block.innerHTML = html;
80088
+ });
80089
+ html = snippet.innerHTML;
80090
+
80091
+ // Clean snippet from sortable related code
80092
+ itemEl.removeAttribute('draggable');
80093
+ this.dom.removeClass(itemEl, 'snippet-item');
80094
+ itemEl.innerHTML = '';
80095
+
80096
+ // Use createContextualFragment() to make embedded script executable
80097
+ // https://ghinda.net/article/script-tags/
80098
+ var range = document.createRange();
80099
+ range.setStart(itemEl, 0);
80100
+ itemEl.appendChild(range.createContextualFragment(html));
80101
+ const blockTemplate = `
80102
+ <div class="is-block block-fixed" style="top: 20%; left: 20%; width: 800px;">
80103
+ <div class="is-container container-new leading-12 size-17">
80104
+ [%CONTENT%]
80105
+ </div>
80106
+ </div>
80107
+ `;
80108
+ itemEl.outerHTML = blockTemplate.replace('[%CONTENT%]', itemEl.innerHTML);
80109
+ }
80110
+ this.activeCol = null;
80111
+ const builders = section.querySelectorAll('.is-container.container-new');
80112
+ builders.forEach(builder => {
80113
+ const block = builder.parentNode;
80114
+ if (lastBlock) {
80115
+ lastBlock.insertAdjacentElement('afterend', block);
80116
+ } else {
80117
+ const ovarlay = section.querySelector('.is-overlay');
80118
+ ovarlay.insertAdjacentElement('afterend', block);
80119
+ }
80120
+
80121
+ // After snippet has been added, re-apply behavior on builder areas
80122
+ this.applyBehaviorOn(builder);
80123
+ builder.classList.remove('container-new');
80124
+ });
80125
+ if (this.opts.onBlockCanvasAdd) this.opts.onBlockCanvasAdd();
80126
+ this.opts.onChange();
80127
+ this.opts.onRender();
80128
+ }
80129
+
80130
+ // destroy
80131
+ if (this.sortableOnCanvas) this.sortableOnCanvas.forEach(obj => {
80132
+ if (obj) {
80133
+ obj.destroy();
80134
+ }
80135
+ });
80136
+ if (this.sortableOnPage) this.sortableOnPage.destroy();
80137
+ }
80138
+ });
80139
+ this.sortableOnCanvas.push(obj);
80140
+ });
79803
80141
  this.sortableOnPage = new Sortable(wrapper, {
79804
80142
  scroll: true,
79805
80143
  group: 'shared',
@@ -79997,7 +80335,14 @@ class ContentBuilder {
79997
80335
  }
79998
80336
 
79999
80337
  // this.sortableOnPage.option('draggable', '.dummy');
80000
- this.sortableOnPage.destroy();
80338
+
80339
+ // destroy
80340
+ if (this.sortableOnCanvas) this.sortableOnCanvas.forEach(obj => {
80341
+ if (obj) {
80342
+ obj.destroy();
80343
+ }
80344
+ });
80345
+ if (this.sortableOnPage) this.sortableOnPage.destroy();
80001
80346
  }
80002
80347
  });
80003
80348
  }