@innovastudio/contentbox 1.6.10 → 1.6.12

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/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.10",
4
+ "version": "1.6.12",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -52,7 +52,7 @@
52
52
  "ws": "^8.13.0"
53
53
  },
54
54
  "dependencies": {
55
- "@innovastudio/contentbuilder": "^1.4.131",
55
+ "@innovastudio/contentbuilder": "^1.4.135",
56
56
  "js-beautify": "^1.14.0"
57
57
  }
58
58
  }
@@ -22799,7 +22799,6 @@ class Util$1 {
22799
22799
  const dom = this.dom;
22800
22800
  const html = `
22801
22801
  <input type="text" class="style-helper-input" style="display:none;">
22802
- <label class="style-helper-label" style="display:none;"></label>
22803
22802
  <button class="style-helper-button-classic classic" style="display:none;"><svg><use xlink:href="#ion-code-working"></use></svg></button>
22804
22803
  <select class="style-helper-select" style="display:none;"><option value=""></option></select>
22805
22804
 
@@ -22847,7 +22846,6 @@ class Util$1 {
22847
22846
  return window.getComputedStyle(btn.querySelector('svg'), null).getPropertyValue('fill');
22848
22847
  };
22849
22848
  const inp = this.builder.builderStuff.querySelector('.style-helper-input');
22850
- const lbl = this.builder.builderStuff.querySelector('.style-helper-label');
22851
22849
  const sel = this.builder.builderStuff.querySelector('.style-helper-select');
22852
22850
  const btnClassic = this.builder.builderStuff.querySelector('.style-helper-button-classic');
22853
22851
  this.builder.styleModalColor = getVal('.modal-color', 'background-color');
@@ -22892,9 +22890,6 @@ class Util$1 {
22892
22890
  this.builder.styleInputBorderBottom = window.getComputedStyle(inp, null).getPropertyValue('border-bottom');
22893
22891
  this.builder.styleInputColor = window.getComputedStyle(inp, null).getPropertyValue('color');
22894
22892
 
22895
- // Label (ex. used in 'Search & Replace' plugin)
22896
- this.builder.styleLabelColor = window.getComputedStyle(lbl, null).getPropertyValue('color');
22897
-
22898
22893
  // Button Classic (ex. used in 'Search & Replace' plugin)
22899
22894
  this.builder.styleButtonClassicBackground = window.getComputedStyle(btnClassic, null).getPropertyValue('background-color');
22900
22895
  this.builder.styleButtonClassicColor = window.getComputedStyle(btnClassic, null).getPropertyValue('color');
@@ -24544,7 +24539,7 @@ class Dom {
24544
24539
  }
24545
24540
  }
24546
24541
  let blocks = [];
24547
- const blockElms = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'pre', 'td', 'th'];
24542
+ const blockElms = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'pre', 'td', 'th', 'li'];
24548
24543
  elements.forEach(item => {
24549
24544
  const tagName = item.tagName.toLowerCase();
24550
24545
  if (blockElms.includes(tagName)) {
@@ -35423,7 +35418,11 @@ class Draggable$1 {
35423
35418
  const elms = document.querySelectorAll(this.opts.selector);
35424
35419
  Array.prototype.forEach.call(elms, elm => {
35425
35420
  elm.setAttribute('draggable', '');
35426
- elm.addEventListener('touchstart', this.dragStart, false);
35421
+
35422
+ // elm.addEventListener('touchstart', this.dragStart, false);
35423
+ elm.addEventListener('touchstart', this.dragStart, {
35424
+ passive: true
35425
+ });
35427
35426
  elm.addEventListener('touchend', this.dragEnd, false);
35428
35427
  elm.addEventListener('mousedown', this.dragStart, false);
35429
35428
  elm.addEventListener('mouseup', this.dragEnd, false);
@@ -67930,7 +67929,7 @@ class ButtonEditor {
67930
67929
  <div class="flex flex-row">
67931
67930
  <div class="flex flex-col" style="margin-right: 40px;">
67932
67931
  <div>
67933
- <label>${util.out('Background Color')}</label>:
67932
+ <span>${util.out('Background Color')}</span>:
67934
67933
  </div>
67935
67934
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
67936
67935
  <button title="${util.out('Background Color')}" class="bg-color-command" style="width:45px;height:40px;border:rgb(0 0 0 / 6%) 1px solid;margin-right:4px"></button>
@@ -67939,7 +67938,7 @@ class ButtonEditor {
67939
67938
 
67940
67939
  <div class="flex flex-col">
67941
67940
  <div>
67942
- <label>${util.out('Text Color')}</label>:
67941
+ <span>${util.out('Text Color')}</span>:
67943
67942
  </div>
67944
67943
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
67945
67944
  <button title="${util.out('Text Color')}" class="text-color-command" style="width:45px;height:40px;border:rgb(0 0 0 / 6%) 1px solid;margin-right:4px"></button>
@@ -67947,7 +67946,7 @@ class ButtonEditor {
67947
67946
  </div>
67948
67947
  <div class="flex flex-col" style="margin-left: 60px;">
67949
67948
  <div>
67950
- <label>${util.out('Width')}</label>:
67949
+ <span>${util.out('Width')}</span>:
67951
67950
  </div>
67952
67951
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
67953
67952
  <button title="${util.out('Auto')}" data-command="auto" class="width-command" style="margin-right:4px">${util.out('Auto')}</button>
@@ -67959,7 +67958,7 @@ class ButtonEditor {
67959
67958
  <div class="flex flex-row" style="margin:15px 0 0">
67960
67959
  <div class="flex flex-col" style="margin-right: 40px;">
67961
67960
  <div>
67962
- <label>${util.out('Border Color')}</label>:
67961
+ <span>${util.out('Border Color')}</span>:
67963
67962
  </div>
67964
67963
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
67965
67964
  <button title="${util.out('Transparent')}" data-command="transparent" class="border-color-command" style="margin-right:4px">${util.out('Transparent')}</button>
@@ -67969,7 +67968,7 @@ class ButtonEditor {
67969
67968
 
67970
67969
  <div class="flex flex-col">
67971
67970
  <div>
67972
- <label>${util.out('Border Thickness')}</label>:
67971
+ <span>${util.out('Border Thickness')}</span>:
67973
67972
  </div>
67974
67973
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
67975
67974
  <button title="${util.out('No Border')}" data-command="0" class="border-width-command" style="margin-right:4px">${util.out('No Border')}</button>
@@ -67982,7 +67981,7 @@ class ButtonEditor {
67982
67981
  <div class="flex flex-row" style="margin:15px 0 0">
67983
67982
  <div class="flex flex-col" style="margin-right: 20px;">
67984
67983
  <div>
67985
- <label>${util.out('Padding Left/Right')}</label>:
67984
+ <span>${util.out('Padding Left/Right')}</span>:
67986
67985
  </div>
67987
67986
  <div class="flex flex-row" style="margin-top:5px">
67988
67987
  <button title="2" data-command="2" class="paddingx-command" style="margin-right:4px">2</button>
@@ -68001,7 +68000,7 @@ class ButtonEditor {
68001
68000
 
68002
68001
  <div class="flex flex-col" style="display:none">
68003
68002
  <div>
68004
- <label>${util.out('Padding Y')}</label>:
68003
+ <span>${util.out('Padding Y')}</span>:
68005
68004
  </div>
68006
68005
  <div class="flex flex-row" style="margin-top:5px">
68007
68006
  <button title="0" data-command="0" class="paddingy-command" style="margin-right:4px">0</button>
@@ -68017,7 +68016,7 @@ class ButtonEditor {
68017
68016
  <div class="flex flex-row" style="margin:15px 0 0">
68018
68017
  <div class="flex flex-col" style="margin-right: 20px;">
68019
68018
  <div>
68020
- <label>${util.out('Padding Top')}</label>:
68019
+ <span>${util.out('Padding Top')}</span>:
68021
68020
  </div>
68022
68021
  <div class="flex flex-row" style="margin-top:5px">
68023
68022
  <button title="0" data-command="0" class="paddingtop-command" style="margin-right:4px">0</button>
@@ -68031,7 +68030,7 @@ class ButtonEditor {
68031
68030
 
68032
68031
  <div class="flex flex-col">
68033
68032
  <div>
68034
- <label>${util.out('Padding Bottom')}</label>:
68033
+ <span>${util.out('Padding Bottom')}</span>:
68035
68034
  </div>
68036
68035
  <div class="flex flex-row" style="margin-top:5px">
68037
68036
  <button title="0" data-command="0" class="paddingbottom-command" style="margin-right:4px">0</button>
@@ -68046,7 +68045,7 @@ class ButtonEditor {
68046
68045
 
68047
68046
  <div class="flex flex-col" style="margin:15px 0 0">
68048
68047
  <div>
68049
- <label>${util.out('Border Radius')}</label>:
68048
+ <span>${util.out('Border Radius')}</span>:
68050
68049
  </div>
68051
68050
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
68052
68051
  <button title="${util.out('None')}" data-command="none" class="border-radius-command" style="margin-right:4px">${util.out('None')}</button>
@@ -68064,7 +68063,7 @@ class ButtonEditor {
68064
68063
  <div class="flex flex-row" style="margin:15px 0 0">
68065
68064
  <div class="flex flex-col" style="margin-right: 20px;">
68066
68065
  <div>
68067
- <label>${util.out('Margin Left')}</label>:
68066
+ <span>${util.out('Margin Left')}</span>:
68068
68067
  </div>
68069
68068
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
68070
68069
  <button title="0" data-command="0" class="ml-command" style="margin-right:4px">0</button>
@@ -68078,7 +68077,7 @@ class ButtonEditor {
68078
68077
 
68079
68078
  <div class="flex flex-col">
68080
68079
  <div>
68081
- <label>${util.out('Margin Right')}</label>:
68080
+ <span>${util.out('Margin Right')}</span>:
68082
68081
  </div>
68083
68082
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
68084
68083
  <button title="0" data-command="0" class="mr-command" style="margin-right:4px">0</button>
@@ -68094,7 +68093,7 @@ class ButtonEditor {
68094
68093
  <div class="flex flex-row" style="margin:15px 0 0">
68095
68094
  <div class="flex flex-col" style="margin-right: 20px;">
68096
68095
  <div>
68097
- <label>${util.out('Margin Top')}</label>:
68096
+ <span>${util.out('Margin Top')}</span>:
68098
68097
  </div>
68099
68098
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
68100
68099
  <button title="0" data-command="0" class="mt-command" style="margin-right:4px">0</button>
@@ -68108,7 +68107,7 @@ class ButtonEditor {
68108
68107
 
68109
68108
  <div class="flex flex-col">
68110
68109
  <div>
68111
- <label>${util.out('Margin Bottom')}</label>:
68110
+ <span>${util.out('Margin Bottom')}</span>:
68112
68111
  </div>
68113
68112
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
68114
68113
  <button title="0" data-command="0" class="mb-command" style="margin-right:4px">0</button>
@@ -68128,7 +68127,7 @@ class ButtonEditor {
68128
68127
  <div class="flex flex-row">
68129
68128
  <div class="flex-col" style="margin-right: 40px;">
68130
68129
  <div>
68131
- <label>${util.out('Background Color')}</label>:
68130
+ <span>${util.out('Background Color')}</span>:
68132
68131
  </div>
68133
68132
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
68134
68133
  <button title="${util.out('Background Color')}" class="bg-color-hover-command" style="width:45px;height:40px;border:rgb(0 0 0 / 6%) 1px solid;margin-right:4px"></button>
@@ -68137,7 +68136,7 @@ class ButtonEditor {
68137
68136
 
68138
68137
  <div class="flex-col">
68139
68138
  <div>
68140
- <label>${util.out('Text Color')}</label>:
68139
+ <span>${util.out('Text Color')}</span>:
68141
68140
  </div>
68142
68141
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
68143
68142
  <button title="${util.out('Dark')}" data-command="dark" class="text-color-hover-command" style="margin-right:4px">${util.out('Dark')}</button>
@@ -68149,7 +68148,7 @@ class ButtonEditor {
68149
68148
 
68150
68149
  <div class="flex flex-col" style="margin:15px 0 0">
68151
68150
  <div>
68152
- <label>${util.out('Border Color')}</label>:
68151
+ <span>${util.out('Border Color')}</span>:
68153
68152
  </div>
68154
68153
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
68155
68154
  <button title="${util.out('Transparent')}" data-command="transparent" class="border-color-hover-command" style="margin-right:4px">${util.out('Transparent')}</button>
@@ -68163,7 +68162,7 @@ class ButtonEditor {
68163
68162
  <div class="flex flex-row">
68164
68163
  <div class="flex flex-col" style="width:250px;margin-right:40px;">
68165
68164
  <div>
68166
- <label>${util.out('Font Size')}</label>:
68165
+ <span>${util.out('Font Size')}</span>:
68167
68166
  </div>
68168
68167
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
68169
68168
  <button title="12" data-command="12" class="font-size-command" style="margin-right:4px">12</button>
@@ -68183,7 +68182,7 @@ class ButtonEditor {
68183
68182
 
68184
68183
  <div class="flex flex-col">
68185
68184
  <div>
68186
- <label>${util.out('Upper/Lower')}</label>:
68185
+ <span>${util.out('Upper/Lower')}</span>:
68187
68186
  </div>
68188
68187
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
68189
68188
  <button title="${util.out('Bold')}" class="textbold-command" style="width:38px;font-family:serif;font-size:14px;text-transform:initial;margin-right:4px">B</button>
@@ -68196,7 +68195,7 @@ class ButtonEditor {
68196
68195
  <div class="flex flex-row" style="margin:15px 0 0">
68197
68196
  <div class="flex flex-col">
68198
68197
  <div>
68199
- <label>${util.out('Letter Spacing')}</label>:
68198
+ <span>${util.out('Letter Spacing')}</span>:
68200
68199
  </div>
68201
68200
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
68202
68201
  <button title="0" data-command="normal" class="letter-spacing-command" style="margin-right:4px">0</button>
@@ -71862,10 +71861,12 @@ class Table {
71862
71861
  const tableModal = this.tableModal;
71863
71862
  if (tableModal.classList.contains('active') && this.builder.activeTable) {
71864
71863
  let activeTd = this.builder.activeTd;
71865
- tableModal.querySelector('.input-table-bgcolor').style.backgroundColor = activeTd.style.backgroundColor;
71866
- tableModal.querySelector('.input-table-textcolor').style.backgroundColor = activeTd.style.color;
71867
- tableModal.querySelector('.input-table-bordercolor').style.backgroundColor = activeTd.style.borderColor;
71868
- tableModal.querySelector('#selCellBorderWidth').value = parseInt(activeTd.style.borderWidth);
71864
+ if (activeTd) {
71865
+ tableModal.querySelector('.input-table-bgcolor').style.backgroundColor = activeTd.style.backgroundColor;
71866
+ tableModal.querySelector('.input-table-textcolor').style.backgroundColor = activeTd.style.color;
71867
+ tableModal.querySelector('.input-table-bordercolor').style.backgroundColor = activeTd.style.borderColor;
71868
+ tableModal.querySelector('#selCellBorderWidth').value = parseInt(activeTd.style.borderWidth);
71869
+ }
71869
71870
  } else {
71870
71871
  tableModal.querySelector('.input-table-bgcolor').style.backgroundColor = '';
71871
71872
  tableModal.querySelector('.input-table-textcolor').style.backgroundColor = '';
@@ -91778,7 +91779,11 @@ class Resizeable {
91778
91779
  pane.addEventListener('mousedown', onMouseDown);
91779
91780
  pane.ownerDocument.addEventListener('mousemove', onMove);
91780
91781
  pane.ownerDocument.addEventListener('mouseup', onUp);
91781
- pane.addEventListener('touchstart', onTouchDown);
91782
+
91783
+ // pane.addEventListener('touchstart', onTouchDown);
91784
+ pane.addEventListener('touchstart', onTouchDown, {
91785
+ passive: true
91786
+ });
91782
91787
  pane.ownerDocument.addEventListener('touchmove', onTouchMove);
91783
91788
  pane.ownerDocument.addEventListener('touchend', onTouchEnd);
91784
91789
  const resizing = () => {
@@ -97884,7 +97889,15 @@ class ContentBuilder {
97884
97889
  let selectedText = selection.toString().trim();
97885
97890
  if (selectedText.length > 0) {
97886
97891
  let elm = this.dom.getElm();
97887
- if (!this.dom.hasClass(elm.parentNode.parentNode, 'is-builder')) {
97892
+ if (this.dom.getStyle(elm, 'display') === 'inline') {
97893
+ elm = elm.closest('li,p,h1,h2,h3,h4,h5,h6,div,pre,td,th,li');
97894
+ if (elm) {
97895
+ if (!this.dom.hasClass(elm.parentNode.parentNode, 'is-builder')) {
97896
+ this.dom.selectElementContents(elm);
97897
+ }
97898
+ }
97899
+ } else {
97900
+ // block
97888
97901
  this.dom.selectElementContents(elm);
97889
97902
  }
97890
97903
  }
@@ -99388,48 +99401,49 @@ class ContentBuilder {
99388
99401
  }, 600);
99389
99402
  return;
99390
99403
  }
99391
-
99392
- // Font Family
99393
- let iframeRte = this.rte.rteFontFamilyOptions.querySelector('iframe');
99394
- let doc1 = iframeRte.contentWindow.document;
99395
-
99396
- // Icons
99397
- let iframeIcons = this.rte.rteIconOptions.querySelector('iframe');
99398
- let doc3 = iframeIcons.contentWindow.document;
99399
- if (doc1.body.innerHTML === '') {
99400
- doc1.open();
99401
- if (!this.opts.emailMode) {
99402
- doc1.write(util.getFontFamilyHTML());
99403
- } else {
99404
- doc1.write(util.getFontFamilyEmail());
99405
- }
99406
- doc1.close();
99407
- } else {
99408
- this.util.refreshFontFamilyStyle1();
99409
- }
99410
- const fontModal = this.builderStuff.querySelector('.is-modal.pickfontfamily');
99411
- if (fontModal) {
99412
- let iframePanel = fontModal.querySelector('iframe');
99413
- let doc2 = iframePanel.contentWindow.document;
99414
- if (doc2.body.innerHTML === '') {
99415
- doc2.open();
99404
+ if (!this.controlPanel) {
99405
+ // Font Family
99406
+ let iframeRte = this.rte.rteFontFamilyOptions.querySelector('iframe');
99407
+ let doc1 = iframeRte.contentWindow.document;
99408
+
99409
+ // Icons
99410
+ let iframeIcons = this.rte.rteIconOptions.querySelector('iframe');
99411
+ let doc3 = iframeIcons.contentWindow.document;
99412
+ if (doc1.body.innerHTML === '') {
99413
+ doc1.open();
99416
99414
  if (!this.opts.emailMode) {
99417
- doc2.write(util.getFontFamilyHTML(true));
99415
+ doc1.write(util.getFontFamilyHTML());
99416
+ } else {
99417
+ doc1.write(util.getFontFamilyEmail());
99418
+ }
99419
+ doc1.close();
99420
+ } else {
99421
+ this.util.refreshFontFamilyStyle1();
99422
+ }
99423
+ const fontModal = this.builderStuff.querySelector('.is-modal.pickfontfamily');
99424
+ if (fontModal) {
99425
+ let iframePanel = fontModal.querySelector('iframe');
99426
+ let doc2 = iframePanel.contentWindow.document;
99427
+ if (doc2.body.innerHTML === '') {
99428
+ doc2.open();
99429
+ if (!this.opts.emailMode) {
99430
+ doc2.write(util.getFontFamilyHTML(true));
99431
+ } else {
99432
+ doc2.write(util.getFontFamilyEmail(true));
99433
+ }
99434
+ doc2.close();
99418
99435
  } else {
99419
- doc2.write(util.getFontFamilyEmail(true));
99436
+ this.util.refreshFontFamilyStyle2();
99420
99437
  }
99421
- doc2.close();
99438
+ }
99439
+ if (doc3.body.innerHTML === '') {
99440
+ doc3.open();
99441
+ doc3.write(this.rte.getIconsHTML());
99442
+ doc3.close();
99422
99443
  } else {
99423
- this.util.refreshFontFamilyStyle2();
99444
+ this.rte.refreshIconsStyle();
99424
99445
  }
99425
99446
  }
99426
- if (doc3.body.innerHTML === '') {
99427
- doc3.open();
99428
- doc3.write(this.rte.getIconsHTML());
99429
- doc3.close();
99430
- } else {
99431
- this.rte.refreshIconsStyle();
99432
- }
99433
99447
 
99434
99448
  // Snippets (Modal)
99435
99449
  let modalSnippets = this.builderStuff.querySelector('.snippets');
@@ -99879,27 +99893,24 @@ class ContentBuilder {
99879
99893
  span.setAttribute('data-keep', '');
99880
99894
  });
99881
99895
 
99882
- // // Cleanup all elements with unwanted style
99883
- // let elms = col.querySelectorAll('*');
99884
- // Array.prototype.forEach.call(elms, (elm) => {
99885
- // let attr = elm.getAttribute('style');
99886
- // if(attr) {
99887
- // if(attr.indexOf('font-size')!==-1){
99888
- // elm.setAttribute('data-keep-font-size','');
99889
- // }
99890
- // if(attr.indexOf('background-color')!==-1){
99891
- // elm.setAttribute('data-keep-background-color','');
99892
- // }
99893
- // if(attr.indexOf('background')!==-1){
99894
- // elm.setAttribute('data-keep-background','');
99895
- // }
99896
- // if(attr.indexOf('line-height')!==-1){
99897
- // elm.setAttribute('data-keep-line-height','');
99898
- // }
99899
- // }
99900
- // });
99901
- // this.autoclean=true;
99902
-
99896
+ // Cleanup all elements with unwanted style
99897
+ let elms = col.querySelectorAll('[style]');
99898
+ elms.forEach(elm => {
99899
+ let attr = elm.getAttribute('style');
99900
+ if (attr.includes('font-size')) {
99901
+ elm.setAttribute('data-keep-font-size', '');
99902
+ }
99903
+ if (attr.includes('background-color')) {
99904
+ elm.setAttribute('data-keep-background-color', '');
99905
+ }
99906
+ if (attr.includes('background')) {
99907
+ elm.setAttribute('data-keep-background', '');
99908
+ }
99909
+ if (attr.includes('line-height')) {
99910
+ elm.setAttribute('data-keep-line-height', '');
99911
+ }
99912
+ });
99913
+ this.autoclean = true;
99903
99914
  if ((e.ctrlKey || e.metaKey) && e.which === 86) ;
99904
99915
  if (this.opts.elementSelection && !this.emailMode) {
99905
99916
  if ((e.ctrlKey || e.metaKey) && e.which === 65) {
@@ -100244,61 +100255,42 @@ class ContentBuilder {
100244
100255
  }
100245
100256
  });
100246
100257
 
100247
- // // Cleanup all elements with unwanted style
100248
- // if(this.autoclean){
100249
- // let elms = col.querySelectorAll('*');
100250
- // Array.prototype.forEach.call(elms, (elm) => {
100251
- // let attr = elm.getAttribute('style');
100252
- // if(attr) {
100253
- // if(attr.indexOf('font-size')!==-1){
100254
- // let attrkeep = elm.getAttribute('data-keep-font-size');
100255
- // if (!attrkeep) {
100256
- // // Remove unwanted font size
100257
- // elm.style.fontSize = '';
100258
- // }
100259
- // }
100260
- // if(attr.indexOf('background-color')!==-1){
100261
- // let attrkeep = elm.getAttribute('data-keep-background-color');
100262
- // if (!attrkeep) {
100263
- // // Remove unwanted background color
100264
- // elm.style.backgroundColor = '';
100265
- // }
100266
- // }
100267
- // if(attr.indexOf('background')!==-1){
100268
- // let attrkeep = elm.getAttribute('data-keep-background');
100269
- // if (!attrkeep) {
100270
- // // Remove unwanted background
100271
- // elm.style.background = '';
100272
- // }
100273
- // }
100274
- // if(attr.indexOf('line-height')!==-1){
100275
- // let attrkeep = elm.getAttribute('data-keep-line-height');
100276
- // if (!attrkeep) {
100277
- // // Remove unwanted line height
100278
- // elm.style.lineHeight = '';
100279
- // }
100280
- // }
100281
- // }
100282
- // });
100283
- // elms = col.querySelectorAll('[data-keep-font-size]');
100284
- // Array.prototype.forEach.call(elms, (elm) => {
100285
- // elm.removeAttribute('data-keep-font-size');
100286
- // });
100287
- // elms = col.querySelectorAll('[data-keep-background-color]');
100288
- // Array.prototype.forEach.call(elms, (elm) => {
100289
- // elm.removeAttribute('data-keep-background-color');
100290
- // });
100291
- // elms = col.querySelectorAll('[data-keep-background]');
100292
- // Array.prototype.forEach.call(elms, (elm) => {
100293
- // elm.removeAttribute('data-keep-background');
100294
- // });
100295
- // elms = col.querySelectorAll('[data-keep-line-height]');
100296
- // Array.prototype.forEach.call(elms, (elm) => {
100297
- // elm.removeAttribute('data-keep-line-height');
100298
- // });
100299
- // }
100300
- // this.autoclean =false;
100301
-
100258
+ // Cleanup all elements with unwanted style
100259
+ if (this.autoclean) {
100260
+ let elms = col.querySelectorAll('[style]');
100261
+ elms.forEach(elm => {
100262
+ let attr = elm.getAttribute('style');
100263
+ if (attr.includes('font-size')) {
100264
+ let attrkeep = elm.hasAttribute('data-keep-font-size');
100265
+ if (!attrkeep) {
100266
+ elm.style.fontSize = '';
100267
+ }
100268
+ }
100269
+ if (attr.includes('background-color')) {
100270
+ let attrkeep = elm.hasAttribute('data-keep-background-color');
100271
+ if (!attrkeep) {
100272
+ elm.style.backgroundColor = '';
100273
+ }
100274
+ }
100275
+ if (attr.includes('background')) {
100276
+ let attrkeep = elm.hasAttribute('data-keep-background');
100277
+ if (!attrkeep) {
100278
+ elm.style.background = '';
100279
+ }
100280
+ }
100281
+ if (attr.includes('line-height')) {
100282
+ let attrkeep = elm.hasAttribute('data-keep-line-height');
100283
+ if (!attrkeep) {
100284
+ elm.style.lineHeight = '';
100285
+ }
100286
+ }
100287
+ });
100288
+ col.querySelectorAll('[data-keep-font-size]').forEach(elm => elm.removeAttribute('data-keep-font-size'));
100289
+ col.querySelectorAll('[data-keep-background-color]').forEach(elm => elm.removeAttribute('data-keep-background-color'));
100290
+ col.querySelectorAll('[data-keep-background]').forEach(elm => elm.removeAttribute('data-keep-background'));
100291
+ col.querySelectorAll('[data-keep-line-height]').forEach(elm => elm.removeAttribute('data-keep-line-height'));
100292
+ }
100293
+ this.autoclean = false;
100302
100294
  var el;
100303
100295
  // var curr;
100304
100296
  try {
@@ -100562,25 +100554,31 @@ class ContentBuilder {
100562
100554
  <span class="size-24">Heading</span>
100563
100555
  So, blocks checking below is made to fix it.
100564
100556
  */
100565
- let blockSelection = false;
100566
- if (blocks.length === 1) {
100567
- if (blocks[0].innerText.trim() === selection.toString().trim()) {
100568
- let range = document.createRange();
100569
- range.selectNodeContents(blocks[0]);
100570
- selection.removeAllRanges();
100571
- selection.addRange(range);
100572
- blockSelection = true;
100573
- }
100574
- }
100575
- if (!blockSelection) {
100576
- const container = this.dom.getElm();
100577
- const sameSelection = container && container.innerText === selection.toString().trim();
100578
- if (sameSelection || selection.toString().trim() === '') {
100579
- let range = document.createRange();
100580
- range.selectNodeContents(container);
100581
- selection.removeAllRanges();
100582
- selection.addRange(range);
100557
+ try {
100558
+ let blockSelection = false;
100559
+ if (selection.toString().trim() !== '') {
100560
+ if (blocks.length === 1) {
100561
+ if (blocks[0].innerText.trim() === selection.toString().trim()) {
100562
+ let range = document.createRange();
100563
+ range.selectNodeContents(blocks[0]);
100564
+ selection.removeAllRanges();
100565
+ selection.addRange(range);
100566
+ blockSelection = true;
100567
+ }
100568
+ }
100569
+ if (!blockSelection) {
100570
+ const container = this.dom.getElm();
100571
+ const sameSelection = container && container.innerText === selection.toString().trim();
100572
+ if (sameSelection || selection.toString().trim() === '') {
100573
+ let range = document.createRange();
100574
+ range.selectNodeContents(container);
100575
+ selection.removeAllRanges();
100576
+ selection.addRange(range);
100577
+ }
100578
+ }
100583
100579
  }
100580
+ } catch (e) {
100581
+ // Do Nothing
100584
100582
  }
100585
100583
  this.doc.execCommand('insertHTML', false, sPastedText);
100586
100584
  if (this.activeCol) {
@@ -125298,7 +125296,12 @@ class IframePanel {
125298
125296
  }
125299
125297
 
125300
125298
  document.body.style.overflowY = 'hidden';
125301
- let checkLoad = setInterval(() => {
125299
+
125300
+ const sleep = s => new Promise(p => setTimeout(p, s * 1000 | 0));
125301
+
125302
+ const timeoutHandler = async () => {
125303
+ await sleep(0.2);
125304
+
125302
125305
  if (iframe.contentDocument.readyState === 'complete') {
125303
125306
  iframe.contentDocument.body.classList.add('iframe-body'); // add .iframe-body class that is required by box/flex.css
125304
125307
  // Check if editable container is ready
@@ -125306,13 +125309,18 @@ class IframePanel {
125306
125309
  let wrapper = iframe.contentDocument.querySelector(this.opts.page);
125307
125310
 
125308
125311
  if (wrapper) {
125309
- clearInterval(checkLoad);
125310
125312
  this.onReady(iframe);
125313
+ } else {
125314
+ timeoutHandler();
125311
125315
  }
125312
125316
 
125313
125317
  iframe.contentDocument.body.style.display = 'flex'; // this removes empty space at the bottom of the page
125318
+ } else {
125319
+ timeoutHandler();
125314
125320
  }
125315
- }, 200);
125321
+ };
125322
+
125323
+ timeoutHandler();
125316
125324
  }
125317
125325
 
125318
125326
  showTooltip() {