@innovastudio/contentbuilder 1.1.21 → 1.1.24

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/contentbuilder",
3
- "version": "1.1.21",
3
+ "version": "1.1.24",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
@@ -4738,8 +4738,8 @@ class Util {
4738
4738
 
4739
4739
  let builderActive = document.querySelector('.builder-active');
4740
4740
  if (builderActive) this.builder.applyBehaviorOn(builderActive);
4741
- cellElement = rowElement.childNodes[0];
4742
- cellElement.click(); //change active block to the newly created
4741
+ cellElement = rowElement.querySelector('div');
4742
+ if (cellElement) cellElement.click(); //change active block to the newly created
4743
4743
  // Change to row selection
4744
4744
 
4745
4745
  rowElement.className = rowElement.className.replace('row-outline', ''); // columnTool = parent.document.querySelector('.is-column-tool');
@@ -17118,7 +17118,7 @@ class Dropdown {
17118
17118
  let dropdown = document.querySelector('.is-selectbox-options[data-group="' + groupname + '"]');
17119
17119
  if (this.opts.dropdown) dropdown = this.opts.dropdown;
17120
17120
  dom$C.addEventListener(selectbox, 'click', () => {
17121
- if (dropdown.style.display === 'none') {
17121
+ if (dropdown.style.display === 'none' || dropdown.style.display === '') {
17122
17122
  let dropdowns = document.querySelectorAll('.is-selectbox-options');
17123
17123
  Array.prototype.forEach.call(dropdowns, elm => {
17124
17124
  elm.style.display = 'none';
@@ -47319,24 +47319,24 @@ class ButtonEditor {
47319
47319
  </div>
47320
47320
 
47321
47321
  <div class="flex flex-row" style="margin:15px 0 0">
47322
- <div class="flex flex-col" style="display:none;margin-right: 40px;">
47322
+ <div class="flex flex-col" style="margin-right: 40px;">
47323
47323
  <div>
47324
- <label>${util.out('Border Thickness')}</label>:
47324
+ <label>${util.out('Border Color')}</label>:
47325
47325
  </div>
47326
47326
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
47327
- <button title="${util.out('No Border')}" data-command="0" class="border-width-command" style="margin-right:4px">${util.out('No Border')}</button>
47328
- <button title="1px" data-command="1" class="border-width-command" style="text-transform:none;margin-right:4px">1px</button>
47329
- <button title="2px" data-command="2" class="border-width-command" style="text-transform:none;margin-right:4px">2px</button>
47327
+ <button title="${util.out('Transparent')}" data-command="transparent" class="border-color-command" style="margin-right:4px">${util.out('Transparent')}</button>
47328
+ <button title="${util.out('Current')}" data-command="current" class="border-color-command" style="margin-right:4px">${util.out('Current')}</button>
47330
47329
  </div>
47331
47330
  </div>
47332
-
47331
+
47333
47332
  <div class="flex flex-col">
47334
47333
  <div>
47335
- <label>${util.out('Border Color')}</label>:
47334
+ <label>${util.out('Border Thickness')}</label>:
47336
47335
  </div>
47337
47336
  <div class="flex flex-row flex-wrap" style="margin-top:5px">
47338
- <button title="${util.out('Transparent')}" data-command="transparent" class="border-color-command" style="margin-right:4px">${util.out('Transparent')}</button>
47339
- <button title="${util.out('Current')}" data-command="current" class="border-color-command" style="margin-right:4px">${util.out('Current')}</button>
47337
+ <button title="${util.out('No Border')}" data-command="0" class="border-width-command" style="margin-right:4px">${util.out('No Border')}</button>
47338
+ <button title="1px" data-command="1" class="border-width-command" style="text-transform:none;margin-right:4px">1px</button>
47339
+ <button title="2px" data-command="2" class="border-width-command" style="text-transform:none;margin-right:4px">2px</button>
47340
47340
  </div>
47341
47341
  </div>
47342
47342
  </div>
@@ -47533,53 +47533,90 @@ class ButtonEditor {
47533
47533
  let btns; //background color
47534
47534
 
47535
47535
  const btnBgColor = buttonModal.querySelector('.bg-color-command');
47536
- btnBgColor.addEventListener('click', () => {
47536
+ btnBgColor.addEventListener('click', e => {
47537
47537
  this.builder.uo.saveForUndo(true); // checkLater = true
47538
+ // this.builder.simpleColorPicker((colorClass)=>{
47539
+ // const activeButton = this.builder.activeButton||this.builder.activeLinkButton;
47540
+ // dom.removeClassesByPrefix(activeButton, 'bg-');
47541
+ // dom.addClass(activeButton, colorClass);
47542
+ // this.applyDefault(activeButton);
47543
+ // setTimeout(()=>{
47544
+ // const currBg = dom.getStyle(activeButton,'background-color');
47545
+ // btnBgColor.style.backgroundColor = currBg;
47546
+ // },160);
47547
+ // this.builder.opts.onChange();
47548
+ // });
47538
47549
 
47539
- this.builder.simpleColorPicker(colorClass => {
47550
+ const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
47551
+ let elm = e.target;
47552
+ this.builder.colorPicker.open(color => {
47540
47553
  const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
47554
+ activeButton.style.backgroundColor = color;
47555
+ activeButton.setAttribute('data-bg', color);
47541
47556
  dom$z.removeClassesByPrefix(activeButton, 'bg-');
47542
- dom$z.addClass(activeButton, colorClass);
47543
- this.applyDefault(activeButton);
47544
- setTimeout(() => {
47545
- const currBg = dom$z.getStyle(activeButton, 'background-color');
47546
- btnBgColor.style.backgroundColor = currBg;
47547
- }, 160);
47557
+ elm.style.backgroundColor = color; // preview
47558
+ //Trigger Change event
47559
+
47548
47560
  this.builder.opts.onChange();
47549
- });
47561
+ }, activeButton.style.backgroundColor);
47550
47562
  }); //text color
47551
47563
 
47552
47564
  const btnTextColor = buttonModal.querySelector('.text-color-command');
47553
- btnTextColor.addEventListener('click', () => {
47565
+ btnTextColor.addEventListener('click', e => {
47554
47566
  this.builder.uo.saveForUndo(true); // checkLater = true
47567
+ // this.builder.simpleColorPicker((colorClass)=>{
47568
+ // const activeButton = this.builder.activeButton||this.builder.activeLinkButton;
47569
+ // dom.removeClassesByPrefix(activeButton, 'text-');
47570
+ // dom.addClass(activeButton, colorClass);
47571
+ // this.applyDefault(activeButton);
47572
+ // setTimeout(function(){
47573
+ // const currColor = dom.getStyle(activeButton,'color');
47574
+ // btnTextColor.style.backgroundColor = currColor;
47575
+ // },160);
47576
+ // this.builder.opts.onChange();
47577
+ // }, 'text');
47555
47578
 
47556
- this.builder.simpleColorPicker(colorClass => {
47579
+ const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
47580
+ let elm = e.target;
47581
+ this.builder.colorPicker.open(color => {
47557
47582
  const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
47583
+ activeButton.style.color = color;
47558
47584
  dom$z.removeClassesByPrefix(activeButton, 'text-');
47559
- dom$z.addClass(activeButton, colorClass);
47560
- this.applyDefault(activeButton);
47561
- setTimeout(function () {
47562
- const currColor = dom$z.getStyle(activeButton, 'color');
47563
- btnTextColor.style.backgroundColor = currColor;
47564
- }, 160);
47585
+ elm.style.backgroundColor = color; // preview
47586
+ //Trigger Change event
47587
+
47565
47588
  this.builder.opts.onChange();
47566
- }, 'text');
47589
+ }, activeButton.style.color);
47567
47590
  }); //hover background color
47568
47591
 
47569
47592
  const btnHoverBgColor = buttonModal.querySelector('.bg-color-hover-command');
47570
- btnHoverBgColor.addEventListener('click', () => {
47593
+ btnHoverBgColor.addEventListener('click', e => {
47571
47594
  this.builder.uo.saveForUndo(true); // checkLater = true
47595
+ // this.builder.simpleColorPicker((colorClass)=>{
47596
+ // const activeButton = this.builder.activeButton||this.builder.activeLinkButton;
47597
+ // dom.removeClassesByPrefix(activeButton, 'hover:bg-');
47598
+ // if(colorClass) dom.addClass(activeButton, 'hover:' + colorClass);
47599
+ // this.applyDefault(activeButton);
47600
+ // this.getVisibleBgColor(colorClass, (color)=>{
47601
+ // btnHoverBgColor.style.backgroundColor = color;
47602
+ // });
47603
+ // this.builder.opts.onChange();
47604
+ // });
47572
47605
 
47573
- this.builder.simpleColorPicker(colorClass => {
47606
+ const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
47607
+ let hoverbgcolor = activeButton.getAttribute('data-hover-bg');
47608
+ let elm = e.target;
47609
+ this.builder.colorPicker.open(color => {
47574
47610
  const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
47611
+ activeButton.setAttribute('data-hover-bg', color);
47575
47612
  dom$z.removeClassesByPrefix(activeButton, 'hover:bg-');
47576
- if (colorClass) dom$z.addClass(activeButton, 'hover:' + colorClass);
47577
- this.applyDefault(activeButton);
47578
- this.getVisibleBgColor(colorClass, color => {
47579
- btnHoverBgColor.style.backgroundColor = color;
47580
- });
47613
+ activeButton.setAttribute('onmouseover', 'if(this.getAttribute(\'data-hover-bg\'))this.style.backgroundColor=this.getAttribute(\'data-hover-bg\');');
47614
+ activeButton.setAttribute('onmouseout', 'if(this.getAttribute(\'data-bg\'))this.style.backgroundColor=this.getAttribute(\'data-bg\');else this.style.backgroundColor=\'\'');
47615
+ elm.style.backgroundColor = color; // preview
47616
+ //Trigger Change event
47617
+
47581
47618
  this.builder.opts.onChange();
47582
- });
47619
+ }, hoverbgcolor ? hoverbgcolor : '');
47583
47620
  }); //hover text color
47584
47621
 
47585
47622
  const btnHoverTextColor = document.querySelectorAll('.text-color-hover-command');
@@ -47657,8 +47694,8 @@ class ButtonEditor {
47657
47694
  const val = btn.getAttribute('data-command');
47658
47695
  const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
47659
47696
  dom$z.removeClass(activeButton, 'border-0');
47660
- dom$z.removeClass(activeButton, 'border');
47661
47697
  dom$z.removeClass(activeButton, 'border-2');
47698
+ dom$z.removeClass(activeButton, 'border');
47662
47699
  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');
47663
47700
  this.applyDefault(activeButton); // Button on/off
47664
47701
 
@@ -47991,12 +48028,16 @@ class ButtonEditor {
47991
48028
  if (item.indexOf('hover:bg-') === 0) {
47992
48029
  this.getVisibleBgColor(item.replace('hover:', ''), color => {
47993
48030
  btnHoverBgColor.style.backgroundColor = color;
48031
+ activeButton.setAttribute('data-hover-bg', color); //new inline
47994
48032
  });
47995
48033
  }
47996
48034
 
47997
48035
  if (item.indexOf('bg-') === 0) {
47998
48036
  this.getVisibleBgColor(item, color => {
47999
48037
  btnBgColor.style.backgroundColor = color;
48038
+ activeButton.setAttribute('data-bg', color); //new inline
48039
+
48040
+ activeButton.style.backgroundColor = color; //new inline
48000
48041
  });
48001
48042
  }
48002
48043
 
@@ -48004,6 +48045,7 @@ class ButtonEditor {
48004
48045
  this.getVisibleTextColor(item, color => {
48005
48046
  btnTextColor.style.backgroundColor = color;
48006
48047
  currColor = color;
48048
+ activeButton.style.color = color; //new inline
48007
48049
  });
48008
48050
  }
48009
48051
  });
@@ -48013,8 +48055,12 @@ class ButtonEditor {
48013
48055
  // if no text-[color] found
48014
48056
  currColor = dom$z.getStyle(activeButton, 'color');
48015
48057
  btnTextColor.style.backgroundColor = currColor;
48016
- }
48058
+ } // NEW: inline color
48017
48059
 
48060
+
48061
+ if (activeButton.style.backgroundColor) btnBgColor.style.backgroundColor = activeButton.style.backgroundColor;
48062
+ if (activeButton.getAttribute('data-hover-bg')) btnHoverBgColor.style.backgroundColor = activeButton.getAttribute('data-hover-bg');
48063
+ if (activeButton.style.color) btnTextColor.style.backgroundColor = activeButton.style.color;
48018
48064
  let btn;
48019
48065
  btn = this.buttonModal.querySelector('.text-color-hover-command.on');
48020
48066
  dom$z.removeClass(btn, 'on');
@@ -48095,6 +48141,20 @@ class ButtonEditor {
48095
48141
  dom$z.addClass(btn, 'on');
48096
48142
  }
48097
48143
 
48144
+ btn = this.buttonModal.querySelector('.border-width-command.on');
48145
+ dom$z.removeClass(btn, 'on');
48146
+
48147
+ if (dom$z.hasClass(activeButton, 'border-0')) {
48148
+ btn = this.buttonModal.querySelector('.border-width-command[data-command="0"]');
48149
+ dom$z.addClass(btn, 'on');
48150
+ } else if (dom$z.hasClass(activeButton, 'border-2')) {
48151
+ btn = this.buttonModal.querySelector('.border-width-command[data-command="2"]');
48152
+ dom$z.addClass(btn, 'on');
48153
+ } else if (dom$z.hasClass(activeButton, 'border')) {
48154
+ btn = this.buttonModal.querySelector('.border-width-command[data-command="1"]');
48155
+ dom$z.addClass(btn, 'on');
48156
+ }
48157
+
48098
48158
  if (activeButton.classList) {
48099
48159
  activeButton.classList.forEach(item => {
48100
48160
  if (item.indexOf('size-') === 0) {
@@ -48305,13 +48365,13 @@ class ButtonEditor {
48305
48365
  applyDefault(link) {
48306
48366
  dom$z.addClass(link, 'transition-all');
48307
48367
  dom$z.addClass(link, 'inline-block');
48308
- dom$z.addClass(link, 'cursor-pointer');
48309
- dom$z.addClass(link, 'border-2');
48368
+ dom$z.addClass(link, 'cursor-pointer'); // dom.addClass(link, 'border-2');
48369
+
48310
48370
  dom$z.addClass(link, 'border-solid');
48311
- dom$z.addClass(link, 'leading-relaxed');
48312
- link.removeAttribute('style');
48313
- link.removeAttribute('onmouseover');
48314
- link.removeAttribute('onmouseout');
48371
+ dom$z.addClass(link, 'leading-relaxed'); // link.removeAttribute('style');
48372
+ // link.removeAttribute('onmouseover');
48373
+ // link.removeAttribute('onmouseout');
48374
+
48315
48375
  link.removeAttribute('data-hover-bgcolor');
48316
48376
  link.removeAttribute('data-hover-color');
48317
48377
  link.removeAttribute('data-hover-bordercolor');