@innovastudio/contentbox 1.6.29 → 1.6.31

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.29",
4
+ "version": "1.6.31",
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.5.6",
55
+ "@innovastudio/contentbuilder": "^1.5.8",
56
56
  "js-beautify": "^1.14.0"
57
57
  }
58
58
  }
@@ -612,6 +612,7 @@ body.controlpanel .is-content-view.mobile {
612
612
  width: 38px;
613
613
  height: 34px;
614
614
  background-color: transparent;
615
+ color: #111;
615
616
  box-shadow: none;
616
617
  margin: 2px;
617
618
  border-radius: 5px;
@@ -1770,10 +1771,14 @@ body.topspace .custom-topbar {
1770
1771
  height: var(--topspace);
1771
1772
  }
1772
1773
 
1773
- @media all and (max-width: 970px) {
1774
+ @media all and (max-width: 1100px) {
1774
1775
  .custom-topbar > div:first-child {
1775
1776
  display: none;
1776
1777
  }
1778
+
1779
+ .custom-topbar > div:nth-child(2) {
1780
+ margin-left: 0;
1781
+ }
1777
1782
  }
1778
1783
  .custom-topbar > div:nth-child(3) {
1779
1784
  justify-content: flex-end;
@@ -8953,19 +8953,56 @@ class Text {
8953
8953
  span.removeAttribute('data-keep');
8954
8954
  }
8955
8955
  }); // clean
8956
+ // let elms = activeColumn.querySelectorAll('ul,p');
8957
+ // Array.prototype.forEach.call(elms, (elm) => {
8958
+ // let text = elm.innerHTML.trim();
8959
+ // if(text==='') {
8960
+ // elm.parentNode.removeChild(elm);
8961
+ // }
8962
+ // });
8956
8963
 
8957
- let elms = activeColumn.querySelectorAll('ul,p');
8958
- Array.prototype.forEach.call(elms, elm => {
8959
- let text = elm.innerHTML.trim();
8964
+ let elm = this.getElm();
8965
+ const ul = elm.closest('ul,ol');
8966
+ const p = elm.closest('p,h1,h2,h3,h4,h5,h6');
8967
+
8968
+ if (ul && p) {
8969
+ /*
8970
+ Case:
8971
+ After applying list, the structure will be:
8972
+ <p style="...">
8973
+ <ul>
8974
+ <li>Lorem ipsum</li>
8975
+ </ul>
8976
+ </p>
8977
+ DOM will reformat this into:
8978
+ <p style="..."></p>
8979
+ <ul>
8980
+ <li>Lorem ipsum</li>
8981
+ </ul>
8982
+ <p></p>
8983
+ The list will lost its style
8984
+ */
8985
+ const list = ul.querySelectorAll('li');
8986
+ list.forEach(li => {
8987
+ this.appendAttributes(p, li);
8988
+ });
8989
+ }
8960
8990
 
8961
- if (text === '') {
8962
- elm.parentNode.removeChild(elm);
8963
- }
8964
- });
8965
8991
  onFinish();
8966
8992
  }, 10);
8967
8993
  }
8968
8994
 
8995
+ appendAttributes(sourceElement, destinationElement) {
8996
+ // Append classes
8997
+ destinationElement.classList.add(...sourceElement.classList); // Append styles
8998
+
8999
+ for (let i = 0; i < sourceElement.style.length; i++) {
9000
+ let property = sourceElement.style[i];
9001
+ let value = sourceElement.style.getPropertyValue(property);
9002
+ destinationElement.style.setProperty(property, value);
9003
+ }
9004
+ }
9005
+
8969
9006
  formatText(command) {
8970
9007
  if (command === 'bold') this.execCommandToggle('fontWeight');
8971
9008
  if (command === 'italic') this.execCommandToggle('fontStyle');
@@ -12476,7 +12513,12 @@ class PanelSvg {
12476
12513
  let currentColor = this.builder.editor.dom.getStyle(svg, 'color');
12477
12514
  const colorpicker = this.builder.editor.colorpicker();
12478
12515
  colorpicker.open(color => {
12479
- svg.style.color = color;
12516
+ if (svg.style.fill) {
12517
+ svg.style.fill = color;
12518
+ } else {
12519
+ svg.style.color = color;
12520
+ }
12521
+
12480
12522
  btnColorPick.style.backgroundColor = color; // preview
12481
12523
 
12482
12524
  this.builder.editor.onChange();
@@ -12556,8 +12598,16 @@ class PanelSvg {
12556
12598
  if (div.classList.contains('text-right')) panel.querySelector('[data-align="right"]').classList.add('on');
12557
12599
  if (div.classList.contains('text-center')) panel.querySelector('[data-align="center"]').classList.add('on');
12558
12600
  if (div.classList.contains('text-justify')) panel.querySelector('[data-align="justify"]').classList.add('on');
12559
- const btnColorPick = panel.querySelector('.btn-color');
12560
- let currentColor = this.builder.editor.dom.getStyle(svg, 'color');
12601
+ const btnColorPick = panel.querySelector('.btn-color'); // let currentColor = this.builder.editor.dom.getStyle(svg, 'color');
12602
+
12603
+ let currentColor;
12604
+
12605
+ if (svg.style.fill) {
12606
+ currentColor = svg.style.fill;
12607
+ } else {
12608
+ currentColor = svg.style.color;
12609
+ }
12610
+
12561
12611
  btnColorPick.style.backgroundColor = currentColor; // panel.querySelectorAll('.fontsizes button').forEach(btn=>btn.classList.remove('on'));
12562
12612
  // let currentSize = svg.getAttribute('width');
12563
12613
  // panel.querySelectorAll('.fontsizes button').forEach(btn=>{
@@ -25193,7 +25243,7 @@ class ControlPanel {
25193
25243
  this.title.innerHTML = titleHtml;
25194
25244
  this.panelIframe.classList.add('active');
25195
25245
  this.objPanelIframe.getState();
25196
- } else if (element.tagName.toLowerCase() === 'i' && element.classList.contains('icon')) {
25246
+ } else if (element.tagName.toLowerCase() === 'i' && (element.classList.contains('icon') || element.classList.contains('bi'))) {
25197
25247
  let titleHtml = out('Icon');
25198
25248
  this.title.innerHTML = titleHtml;
25199
25249
  this.panelIcon.classList.add('active');
@@ -26831,11 +26881,13 @@ const renderQuickAdd = builder => {
26831
26881
  elm = quickadd.querySelector('.add-social');
26832
26882
  dom.addEventListener(elm, 'click', () => {
26833
26883
  const mode = quickadd.getAttribute('data-mode');
26834
- const html = `<div class="is-social" style="text-align: center;">
26835
- <a href="https://twitter.com/"><i class="icon ion-social-twitter" style="margin-right: 1em"></i></a>
26836
- <a href="https://www.facebook.com/"><i class="icon ion-social-facebook" style="margin-right: 1em"></i></a>
26837
- <a href="mailto:you@example.com"><i class="icon ion-android-drafts"></i></a>
26838
- </div>`;
26884
+ const html = `
26885
+ <div class="is-social text-left">
26886
+ <a href="https://twitter.com/"><i class="bi bi-twitter-x"></i></a>
26887
+ <a href="https://www.facebook.com/"><i class="bi bi-facebook"></i></a>
26888
+ <a href="https://www.instagram.com/" title=""><i class="icon bi bi-instagram"></i></a>
26889
+ </div>
26890
+ `;
26839
26891
  util.addContent(html, mode);
26840
26892
  });
26841
26893
  elm = quickadd.querySelector('.add-map');
@@ -70594,6 +70646,8 @@ class Image$1 {
70594
70646
  try {
70595
70647
  img.setAttribute('data-filename', input.files[0].name); //needed for saveimage.js |
70596
70648
 
70649
+ // img.crossOrigin = 'anonymous';
70650
+
70597
70651
  this.processImage(input.files[0], img, () => {
70598
70652
  imageProgress.style.display = 'none';
70599
70653
  elm = imageTool.querySelector('#fileEmbedImage');
@@ -96598,7 +96652,7 @@ class Rte {
96598
96652
  addIcon(classname) {
96599
96653
  const dom = this.dom;
96600
96654
  this.util.restoreSelection();
96601
- if (this.builder.activeIcon) {
96655
+ if (this.builder.activeIcon && this.builder.doc.contains(this.builder.activeIcon)) {
96602
96656
  this.builder.uo.saveForUndo();
96603
96657
 
96604
96658
  /*
@@ -96630,6 +96684,12 @@ class Rte {
96630
96684
  this.builder.uo.saveForUndo();
96631
96685
  this.util.pasteHtmlAtCaret('<i class="' + classname + ' icon-active"></i>', true);
96632
96686
  this.builder.activeIcon = this.builder.doc.querySelector('.icon-active');
96687
+
96688
+ // this.util.pasteHtmlAtCaret('<i class="icon-active"></i>', true);
96689
+ // const newIcon = this.builder.doc.querySelector('.icon-active');
96690
+ // newIcon.className = classname + ' icon-active';
96691
+ // this.builder.activeIcon = newIcon;
96692
+
96633
96693
  dom.selectElementContents(this.builder.activeIcon);
96634
96694
  this.util.saveSelection();
96635
96695
  }
@@ -147514,7 +147574,12 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
147514
147574
  transition: none !important;
147515
147575
  z-index:1;
147516
147576
  }
147517
- </style>`);
147577
+
147578
+
147579
+ i.bi, i.icon { display: inline-flex; }
147580
+
147581
+ </style>`); // i.bi, i.icon { display: inline-flex; } => this makes icons more cursor friendly
147582
+
147518
147583
  dom.appendHtml(document.head, `<style id="_contentboxstuff_css">
147519
147584
 
147520
147585
  #_cbhtml .is-modal.editbox.is-modal-content {