@innovastudio/contentbox 1.2.28 → 1.2.31

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
- "version": "1.2.28",
3
+ "version": "1.2.31",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
@@ -46,7 +46,7 @@
46
46
  "webpack-dev-server": "^4.0.0"
47
47
  },
48
48
  "dependencies": {
49
- "@innovastudio/contentbuilder": "^1.1.23",
49
+ "@innovastudio/contentbuilder": "^1.1.24",
50
50
  "js-beautify": "^1.14.0"
51
51
  }
52
52
  }
@@ -9143,14 +9143,20 @@ class EditBox {
9143
9143
  const chkBoxBgImageGrayscale = modalEditBox.querySelector('.chk-box-bgimage-grayscale');
9144
9144
  chkBoxBgImageGrayscale.addEventListener('click', () => {
9145
9145
  const activeBox = this.builder.activeBox;
9146
+ const overlay = activeBox.querySelector('.is-overlay');
9146
9147
  const overlayBg = activeBox.querySelector('.is-overlay-bg');
9147
9148
 
9148
9149
  if (chkBoxBgImageGrayscale.checked) {
9149
9150
  overlayBg.style.filter = 'grayscale(1)';
9151
+ overlay.style.filter = 'grayscale(1)';
9150
9152
  } else {
9151
9153
  if (overlayBg.style.filter) {
9152
9154
  overlayBg.style.filter = overlayBg.style.filter.replace('grayscale(1)', '');
9153
9155
  }
9156
+
9157
+ if (overlay.style.filter) {
9158
+ overlay.style.filter = overlay.style.filter.replace('grayscale(1)', '');
9159
+ }
9154
9160
  }
9155
9161
  });
9156
9162
  const chkBoxAddText = modalEditBox.querySelector('.cmd-box-addtext');
@@ -9444,6 +9450,7 @@ class EditBox {
9444
9450
  const builderStuff = this.builderStuff;
9445
9451
  const modalEditBox = builderStuff.querySelector('.is-modal.editbox');
9446
9452
  const activeBox = this.builder.activeBox;
9453
+ let overlay = activeBox.querySelector('.is-overlay');
9447
9454
  const overlayBg = activeBox.querySelector('.is-overlay-bg');
9448
9455
  const overlayVideo = activeBox.querySelector('.is-video-bg');
9449
9456
  const overlayContent = activeBox.querySelector('.is-overlay-content');
@@ -9718,10 +9725,21 @@ class EditBox {
9718
9725
  if (url !== '') {
9719
9726
  divPreview.innerHTML = `<img src="${url}">`;
9720
9727
 
9728
+ if (overlay) {
9729
+ if (overlay.style.filter) {
9730
+ if (overlay.style.filter.indexOf('grayscale') !== -1) {
9731
+ chkImageGrayscale.checked = true;
9732
+ }
9733
+ }
9734
+ }
9735
+
9721
9736
  if (overlayBg) {
9722
9737
  if (overlayBg.style.filter) {
9723
9738
  if (overlayBg.style.filter.indexOf('grayscale') !== -1) {
9724
9739
  chkImageGrayscale.checked = true;
9740
+ overlay.style.filter = 'grayscale(1)'; // Change filter from -is-overlay-bg to is-overlay (to prevent conflict with animation)
9741
+
9742
+ overlayBg.style.filter = overlayBg.style.filter.replace('grayscale(1)', '');
9725
9743
  }
9726
9744
  }
9727
9745
  }
@@ -9755,8 +9773,6 @@ class EditBox {
9755
9773
  } // FIX OLD VERSION
9756
9774
 
9757
9775
 
9758
- let overlay = activeBox.querySelector('.is-overlay');
9759
-
9760
9776
  if (overlay) ; else {
9761
9777
  activeBox.insertAdjacentHTML('afterbegin', '<div class="is-overlay"></div>');
9762
9778
  overlay = activeBox.querySelector('.is-overlay');
@@ -57917,24 +57933,24 @@ class ButtonEditor {
57917
57933
  </div>
57918
57934
 
57919
57935
  <div class="flex flex-row" style="margin:15px 0 0">
57920
- <div class="flex flex-col" style="display:none;margin-right: 40px;">
57936
+ <div class="flex flex-col" style="margin-right: 40px;">
57921
57937
  <div>
57922
- <label>${util.out('Border Thickness')}</label>:
57938
+ <label>${util.out('Border Color')}</label>:
57923
57939
  </div>
57924
57940
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
57925
- <button title="${util.out('No Border')}" data-command="0" class="border-width-command" style="margin-right:4px">${util.out('No Border')}</button>
57926
- <button title="1px" data-command="1" class="border-width-command" style="text-transform:none;margin-right:4px">1px</button>
57927
- <button title="2px" data-command="2" class="border-width-command" style="text-transform:none;margin-right:4px">2px</button>
57941
+ <button title="${util.out('Transparent')}" data-command="transparent" class="border-color-command" style="margin-right:4px">${util.out('Transparent')}</button>
57942
+ <button title="${util.out('Current')}" data-command="current" class="border-color-command" style="margin-right:4px">${util.out('Current')}</button>
57928
57943
  </div>
57929
57944
  </div>
57930
-
57945
+
57931
57946
  <div class="flex flex-col">
57932
57947
  <div>
57933
- <label>${util.out('Border Color')}</label>:
57948
+ <label>${util.out('Border Thickness')}</label>:
57934
57949
  </div>
57935
57950
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
57936
- <button title="${util.out('Transparent')}" data-command="transparent" class="border-color-command" style="margin-right:4px">${util.out('Transparent')}</button>
57937
- <button title="${util.out('Current')}" data-command="current" class="border-color-command" style="margin-right:4px">${util.out('Current')}</button>
57951
+ <button title="${util.out('No Border')}" data-command="0" class="border-width-command" style="margin-right:4px">${util.out('No Border')}</button>
57952
+ <button title="1px" data-command="1" class="border-width-command" style="text-transform:none;margin-right:4px">1px</button>
57953
+ <button title="2px" data-command="2" class="border-width-command" style="text-transform:none;margin-right:4px">2px</button>
57938
57954
  </div>
57939
57955
  </div>
57940
57956
  </div>
@@ -58131,53 +58147,90 @@ class ButtonEditor {
58131
58147
  let btns; //background color
58132
58148
 
58133
58149
  const btnBgColor = buttonModal.querySelector('.bg-color-command');
58134
- btnBgColor.addEventListener('click', () => {
58150
+ btnBgColor.addEventListener('click', e => {
58135
58151
  this.builder.uo.saveForUndo(true); // checkLater = true
58152
+ // this.builder.simpleColorPicker((colorClass)=>{
58153
+ // const activeButton = this.builder.activeButton||this.builder.activeLinkButton;
58154
+ // dom.removeClassesByPrefix(activeButton, 'bg-');
58155
+ // dom.addClass(activeButton, colorClass);
58156
+ // this.applyDefault(activeButton);
58157
+ // setTimeout(()=>{
58158
+ // const currBg = dom.getStyle(activeButton,'background-color');
58159
+ // btnBgColor.style.backgroundColor = currBg;
58160
+ // },160);
58161
+ // this.builder.opts.onChange();
58162
+ // });
58136
58163
 
58137
- this.builder.simpleColorPicker(colorClass => {
58164
+ const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
58165
+ let elm = e.target;
58166
+ this.builder.colorPicker.open(color => {
58138
58167
  const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
58168
+ activeButton.style.backgroundColor = color;
58169
+ activeButton.setAttribute('data-bg', color);
58139
58170
  dom$z.removeClassesByPrefix(activeButton, 'bg-');
58140
- dom$z.addClass(activeButton, colorClass);
58141
- this.applyDefault(activeButton);
58142
- setTimeout(() => {
58143
- const currBg = dom$z.getStyle(activeButton, 'background-color');
58144
- btnBgColor.style.backgroundColor = currBg;
58145
- }, 160);
58171
+ elm.style.backgroundColor = color; // preview
58172
+ //Trigger Change event
58173
+
58146
58174
  this.builder.opts.onChange();
58147
- });
58175
+ }, activeButton.style.backgroundColor);
58148
58176
  }); //text color
58149
58177
 
58150
58178
  const btnTextColor = buttonModal.querySelector('.text-color-command');
58151
- btnTextColor.addEventListener('click', () => {
58179
+ btnTextColor.addEventListener('click', e => {
58152
58180
  this.builder.uo.saveForUndo(true); // checkLater = true
58181
+ // this.builder.simpleColorPicker((colorClass)=>{
58182
+ // const activeButton = this.builder.activeButton||this.builder.activeLinkButton;
58183
+ // dom.removeClassesByPrefix(activeButton, 'text-');
58184
+ // dom.addClass(activeButton, colorClass);
58185
+ // this.applyDefault(activeButton);
58186
+ // setTimeout(function(){
58187
+ // const currColor = dom.getStyle(activeButton,'color');
58188
+ // btnTextColor.style.backgroundColor = currColor;
58189
+ // },160);
58190
+ // this.builder.opts.onChange();
58191
+ // }, 'text');
58153
58192
 
58154
- this.builder.simpleColorPicker(colorClass => {
58193
+ const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
58194
+ let elm = e.target;
58195
+ this.builder.colorPicker.open(color => {
58155
58196
  const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
58197
+ activeButton.style.color = color;
58156
58198
  dom$z.removeClassesByPrefix(activeButton, 'text-');
58157
- dom$z.addClass(activeButton, colorClass);
58158
- this.applyDefault(activeButton);
58159
- setTimeout(function () {
58160
- const currColor = dom$z.getStyle(activeButton, 'color');
58161
- btnTextColor.style.backgroundColor = currColor;
58162
- }, 160);
58199
+ elm.style.backgroundColor = color; // preview
58200
+ //Trigger Change event
58201
+
58163
58202
  this.builder.opts.onChange();
58164
- }, 'text');
58203
+ }, activeButton.style.color);
58165
58204
  }); //hover background color
58166
58205
 
58167
58206
  const btnHoverBgColor = buttonModal.querySelector('.bg-color-hover-command');
58168
- btnHoverBgColor.addEventListener('click', () => {
58207
+ btnHoverBgColor.addEventListener('click', e => {
58169
58208
  this.builder.uo.saveForUndo(true); // checkLater = true
58209
+ // this.builder.simpleColorPicker((colorClass)=>{
58210
+ // const activeButton = this.builder.activeButton||this.builder.activeLinkButton;
58211
+ // dom.removeClassesByPrefix(activeButton, 'hover:bg-');
58212
+ // if(colorClass) dom.addClass(activeButton, 'hover:' + colorClass);
58213
+ // this.applyDefault(activeButton);
58214
+ // this.getVisibleBgColor(colorClass, (color)=>{
58215
+ // btnHoverBgColor.style.backgroundColor = color;
58216
+ // });
58217
+ // this.builder.opts.onChange();
58218
+ // });
58170
58219
 
58171
- this.builder.simpleColorPicker(colorClass => {
58220
+ const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
58221
+ let hoverbgcolor = activeButton.getAttribute('data-hover-bg');
58222
+ let elm = e.target;
58223
+ this.builder.colorPicker.open(color => {
58172
58224
  const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
58225
+ activeButton.setAttribute('data-hover-bg', color);
58173
58226
  dom$z.removeClassesByPrefix(activeButton, 'hover:bg-');
58174
- if (colorClass) dom$z.addClass(activeButton, 'hover:' + colorClass);
58175
- this.applyDefault(activeButton);
58176
- this.getVisibleBgColor(colorClass, color => {
58177
- btnHoverBgColor.style.backgroundColor = color;
58178
- });
58227
+ activeButton.setAttribute('onmouseover', 'if(this.getAttribute(\'data-hover-bg\'))this.style.backgroundColor=this.getAttribute(\'data-hover-bg\');');
58228
+ activeButton.setAttribute('onmouseout', 'if(this.getAttribute(\'data-bg\'))this.style.backgroundColor=this.getAttribute(\'data-bg\');else this.style.backgroundColor=\'\'');
58229
+ elm.style.backgroundColor = color; // preview
58230
+ //Trigger Change event
58231
+
58179
58232
  this.builder.opts.onChange();
58180
- });
58233
+ }, hoverbgcolor ? hoverbgcolor : '');
58181
58234
  }); //hover text color
58182
58235
 
58183
58236
  const btnHoverTextColor = document.querySelectorAll('.text-color-hover-command');
@@ -58255,8 +58308,8 @@ class ButtonEditor {
58255
58308
  const val = btn.getAttribute('data-command');
58256
58309
  const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
58257
58310
  dom$z.removeClass(activeButton, 'border-0');
58258
- dom$z.removeClass(activeButton, 'border');
58259
58311
  dom$z.removeClass(activeButton, 'border-2');
58312
+ dom$z.removeClass(activeButton, 'border');
58260
58313
  if (val === '0') dom$z.addClass(activeButton, 'border-0');else if (val === '1') dom$z.addClass(activeButton, 'border');else if (val === '2') dom$z.addClass(activeButton, 'border-2');
58261
58314
  this.applyDefault(activeButton); // Button on/off
58262
58315
 
@@ -58589,12 +58642,16 @@ class ButtonEditor {
58589
58642
  if (item.indexOf('hover:bg-') === 0) {
58590
58643
  this.getVisibleBgColor(item.replace('hover:', ''), color => {
58591
58644
  btnHoverBgColor.style.backgroundColor = color;
58645
+ activeButton.setAttribute('data-hover-bg', color); //new inline
58592
58646
  });
58593
58647
  }
58594
58648
 
58595
58649
  if (item.indexOf('bg-') === 0) {
58596
58650
  this.getVisibleBgColor(item, color => {
58597
58651
  btnBgColor.style.backgroundColor = color;
58652
+ activeButton.setAttribute('data-bg', color); //new inline
58653
+
58654
+ activeButton.style.backgroundColor = color; //new inline
58598
58655
  });
58599
58656
  }
58600
58657
 
@@ -58602,6 +58659,7 @@ class ButtonEditor {
58602
58659
  this.getVisibleTextColor(item, color => {
58603
58660
  btnTextColor.style.backgroundColor = color;
58604
58661
  currColor = color;
58662
+ activeButton.style.color = color; //new inline
58605
58663
  });
58606
58664
  }
58607
58665
  });
@@ -58611,8 +58669,12 @@ class ButtonEditor {
58611
58669
  // if no text-[color] found
58612
58670
  currColor = dom$z.getStyle(activeButton, 'color');
58613
58671
  btnTextColor.style.backgroundColor = currColor;
58614
- }
58672
+ } // NEW: inline color
58615
58673
 
58674
+
58675
+ if (activeButton.style.backgroundColor) btnBgColor.style.backgroundColor = activeButton.style.backgroundColor;
58676
+ if (activeButton.getAttribute('data-hover-bg')) btnHoverBgColor.style.backgroundColor = activeButton.getAttribute('data-hover-bg');
58677
+ if (activeButton.style.color) btnTextColor.style.backgroundColor = activeButton.style.color;
58616
58678
  let btn;
58617
58679
  btn = this.buttonModal.querySelector('.text-color-hover-command.on');
58618
58680
  dom$z.removeClass(btn, 'on');
@@ -58693,6 +58755,20 @@ class ButtonEditor {
58693
58755
  dom$z.addClass(btn, 'on');
58694
58756
  }
58695
58757
 
58758
+ btn = this.buttonModal.querySelector('.border-width-command.on');
58759
+ dom$z.removeClass(btn, 'on');
58760
+
58761
+ if (dom$z.hasClass(activeButton, 'border-0')) {
58762
+ btn = this.buttonModal.querySelector('.border-width-command[data-command="0"]');
58763
+ dom$z.addClass(btn, 'on');
58764
+ } else if (dom$z.hasClass(activeButton, 'border-2')) {
58765
+ btn = this.buttonModal.querySelector('.border-width-command[data-command="2"]');
58766
+ dom$z.addClass(btn, 'on');
58767
+ } else if (dom$z.hasClass(activeButton, 'border')) {
58768
+ btn = this.buttonModal.querySelector('.border-width-command[data-command="1"]');
58769
+ dom$z.addClass(btn, 'on');
58770
+ }
58771
+
58696
58772
  if (activeButton.classList) {
58697
58773
  activeButton.classList.forEach(item => {
58698
58774
  if (item.indexOf('size-') === 0) {
@@ -58903,13 +58979,13 @@ class ButtonEditor {
58903
58979
  applyDefault(link) {
58904
58980
  dom$z.addClass(link, 'transition-all');
58905
58981
  dom$z.addClass(link, 'inline-block');
58906
- dom$z.addClass(link, 'cursor-pointer');
58907
- dom$z.addClass(link, 'border-2');
58982
+ dom$z.addClass(link, 'cursor-pointer'); // dom.addClass(link, 'border-2');
58983
+
58908
58984
  dom$z.addClass(link, 'border-solid');
58909
- dom$z.addClass(link, 'leading-relaxed');
58910
- link.removeAttribute('style');
58911
- link.removeAttribute('onmouseover');
58912
- link.removeAttribute('onmouseout');
58985
+ dom$z.addClass(link, 'leading-relaxed'); // link.removeAttribute('style');
58986
+ // link.removeAttribute('onmouseover');
58987
+ // link.removeAttribute('onmouseout');
58988
+
58913
58989
  link.removeAttribute('data-hover-bgcolor');
58914
58990
  link.removeAttribute('data-hover-color');
58915
58991
  link.removeAttribute('data-hover-bordercolor');
@@ -84212,6 +84288,15 @@ class ContentBox {
84212
84288
  this.boxSetup(box);
84213
84289
  });
84214
84290
  }
84291
+ }); // Change filter from -is-overlay-bg to is-overlay (to prevent conflict with animation)
84292
+
84293
+ let overlayBgs = document.querySelectorAll('.is-overlay-bg');
84294
+ overlayBgs.forEach(elm => {
84295
+ if (elm.style) if (elm.style.filter) {
84296
+ if (elm.style.filter.indexOf('grayscale') !== -1) {
84297
+ elm.parentNode.style.filter = 'grayscale(1)';
84298
+ }
84299
+ }
84215
84300
  });
84216
84301
  this.editor.applyBehavior(); // Re-apply
84217
84302