@innovastudio/contentbuilder 1.3.9 → 1.3.11

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/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.3.9",
4
+ "version": "1.3.11",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -807,10 +807,6 @@ button:focus {
807
807
  .is-ui .is-rte-pop button:hover {
808
808
  background: whitesmoke;
809
809
  }
810
- #_cbhtml .is-rte-pop button:focus,
811
- .is-ui .is-rte-pop button:focus {
812
- outline: none;
813
- }
814
810
  #_cbhtml .is-rte-pop .is-label,
815
811
  .is-ui .is-rte-pop .is-label {
816
812
  font-size: 9px;
@@ -1035,7 +1031,6 @@ button:focus {
1035
1031
  }
1036
1032
  #_cbhtml .is-rte-pop.rte-color-picker button:focus,
1037
1033
  .is-ui .is-rte-pop.rte-color-picker button:focus {
1038
- outline: #3e93f7 2px solid;
1039
1034
  outline-offset: -2px;
1040
1035
  }
1041
1036
  #_cbhtml .is-rte-pop.rte-color-picker input[type=text]:focus,
@@ -3068,7 +3063,6 @@ button:focus {
3068
3063
  #_cbhtml .is-btn:focus,
3069
3064
  .is-ui button:focus,
3070
3065
  .is-ui .is-btn:focus {
3071
- outline: #3e93f7 2px solid;
3072
3066
  outline-offset: 0;
3073
3067
  }
3074
3068
  #_cbhtml button.fullwidth,
@@ -3179,7 +3173,6 @@ button:focus {
3179
3173
  }
3180
3174
  #_cbhtml select:focus,
3181
3175
  .is-ui select:focus {
3182
- outline: #3e93f7 2px solid;
3183
3176
  outline-offset: 0;
3184
3177
  box-shadow: none;
3185
3178
  }
@@ -3992,7 +3985,6 @@ button:focus {
3992
3985
  }
3993
3986
  #_cbhtml .pickcolor button:focus,
3994
3987
  .is-ui .pickcolor button:focus {
3995
- outline: #3e93f7 2px solid;
3996
3988
  outline-offset: -2px;
3997
3989
  }
3998
3990
  #_cbhtml .pickcolor input[type=text]:focus,
@@ -14994,9 +14994,12 @@ class HtmlUtil {
14994
14994
  col.style.cursor = '';
14995
14995
  });
14996
14996
  });
14997
- });
14997
+ }); // cleanup cursor from drag to resize columns
14998
+
14998
14999
  const rows = dom$h.elementChildren(tmp);
14999
15000
  rows.forEach(row => {
15001
+ row.style.cursor = ''; //if tmp is row html, then this is a column
15002
+
15000
15003
  const cols = dom$h.elementChildren(row);
15001
15004
  cols.forEach(col => {
15002
15005
  col.style.cursor = '';
@@ -66271,26 +66274,61 @@ class Rte {
66271
66274
 
66272
66275
  const command = item.getAttribute('data-block'); //h1, h2, h3, h4, p, pre
66273
66276
 
66277
+ /*
66274
66278
  let block = this.builder.doc.queryCommandValue('FormatBlock');
66275
66279
  block = block.toLowerCase();
66276
-
66277
66280
  if (block === 'pre') {
66278
- let elm = dom.textSelection();
66281
+ let elm = dom.textSelection();
66282
+ if(elm) {
66283
+ let pre = elm.closest('pre');
66284
+ if(pre) {
66285
+ let newnode = pre.cloneNode(true);
66286
+ let s = newnode.outerHTML.replace('<pre', '<' + command);
66287
+ s = s.replace('</pre>', '</' + command + '>');
66288
+ pre.outerHTML = s;
66289
+ }
66290
+ pre.focus();
66291
+ }
66292
+ } else {
66293
+ this.builder.doc.execCommand('formatBlock', false, '<' + command + '>'); //Needs contenteditable.
66294
+ }
66295
+ */
66279
66296
 
66280
- if (elm) {
66281
- let pre = elm.closest('pre');
66297
+ const selection = dom.getSelection();
66298
+ if (!selection) return;
66299
+ const anchorNode = selection.anchorNode;
66300
+ let container;
66301
+
66302
+ if (anchorNode) {
66303
+ container = anchorNode.nodeType !== Node.TEXT_NODE && anchorNode.nodeType !== Node.COMMENT_NODE ? anchorNode : anchorNode.parentElement;
66304
+ }
66305
+
66306
+ if (!container) return;
66307
+ let element = container.closest('h1') || container.closest('h2') || container.closest('h3') || container.closest('h4') || container.closest('h5') || container.closest('h6') || container.closest('pre') || container.closest('p');
66308
+
66309
+ if (element) {
66310
+ // const tagName = element.tagName.toLowerCase();
66311
+ element.setAttribute('data-replacetagname', '1');
66312
+ const newElement = document.createElement(command); // Copy the attributes
66313
+
66314
+ for (var i = 0, l = element.attributes.length; i < l; ++i) {
66315
+ var nodeName = element.attributes.item(i).nodeName;
66316
+ var nodeValue = element.attributes.item(i).nodeValue;
66317
+ newElement.setAttribute(nodeName, nodeValue);
66318
+ } // move all elements in the other container.
66282
66319
 
66283
- if (pre) {
66284
- let newnode = pre.cloneNode(true);
66285
- let s = newnode.outerHTML.replace('<pre', '<' + command);
66286
- s = s.replace('</pre>', '</' + command + '>');
66287
- pre.outerHTML = s;
66288
- }
66289
66320
 
66290
- pre.focus();
66321
+ while (element.firstChild) {
66322
+ newElement.appendChild(element.firstChild);
66323
+ }
66324
+
66325
+ element.parentNode.replaceChild(newElement, element);
66326
+ const result = document.querySelector('[data-replacetagname="1"]');
66327
+
66328
+ if (result) {
66329
+ result.removeAttribute('data-replacetagname');
66330
+ dom.selectElementContents(result);
66291
66331
  }
66292
- } else {
66293
- this.builder.doc.execCommand('formatBlock', false, '<' + command + '>'); //Needs contenteditable.
66294
66332
  } //save selection
66295
66333
 
66296
66334
 
@@ -67930,7 +67968,7 @@ class Rte {
67930
67968
  for (let i = 0; i < Object.keys(classes).length; i++) {
67931
67969
  let className = Object.values(classes)[i];
67932
67970
 
67933
- if (dom.hasClass(container, className)) {
67971
+ if (container.closest(`.${className}`)) {
67934
67972
  if (num === '+') {
67935
67973
  if (i + 1 === Object.keys(classes).length) return;
67936
67974
  newClassName = Object.values(classes)[i + 1];