@innovastudio/contentbox 1.4.11 → 1.4.13
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.4.
|
4
|
+
"version": "1.4.13",
|
5
5
|
"description": "",
|
6
6
|
"main": "public/contentbox/contentbox.esm.js",
|
7
7
|
"files": [
|
@@ -46,7 +46,7 @@
|
|
46
46
|
"webpack-dev-server": "^4.0.0"
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
|
-
"@innovastudio/contentbuilder": "^1.3.
|
49
|
+
"@innovastudio/contentbuilder": "^1.3.11",
|
50
50
|
"js-beautify": "^1.14.0"
|
51
51
|
}
|
52
52
|
}
|
@@ -12125,7 +12125,11 @@ class EditBox {
|
|
12125
12125
|
dom$j.removeClass(elm, 'center');
|
12126
12126
|
let elms = activeBox.querySelectorAll('.is-builder > div > div, .is-builder > div > div > *');
|
12127
12127
|
elms.forEach(elm => {
|
12128
|
+
if (elm.closest('.is-section-tool') || elm.closest('.is-box-tool') || elm.closest('.is-tool') || elm.closest('.is-rowadd-tool')) return;
|
12128
12129
|
elm.style.textAlign = '';
|
12130
|
+
dom$j.removeClass(elm, 'left');
|
12131
|
+
dom$j.removeClass(elm, 'right');
|
12132
|
+
dom$j.removeClass(elm, 'center');
|
12129
12133
|
dom$j.removeClass(elm, this.builder.cssClasses.textAlign.left);
|
12130
12134
|
dom$j.removeClass(elm, this.builder.cssClasses.textAlign.center);
|
12131
12135
|
dom$j.removeClass(elm, this.builder.cssClasses.textAlign.right);
|
@@ -12133,6 +12137,9 @@ class EditBox {
|
|
12133
12137
|
this.builder.editor.dom.doFunction(elm, theEl => {
|
12134
12138
|
if (theEl.closest('.is-section-tool') || theEl.closest('.is-box-tool') || theEl.closest('.is-tool') || theEl.closest('.is-rowadd-tool')) return;
|
12135
12139
|
theEl.style.textAlign = '';
|
12140
|
+
dom$j.removeClass(theEl, 'left');
|
12141
|
+
dom$j.removeClass(theEl, 'right');
|
12142
|
+
dom$j.removeClass(theEl, 'center');
|
12136
12143
|
dom$j.removeClass(theEl, this.builder.cssClasses.textAlign.left);
|
12137
12144
|
dom$j.removeClass(theEl, this.builder.cssClasses.textAlign.center);
|
12138
12145
|
dom$j.removeClass(theEl, this.builder.cssClasses.textAlign.right);
|
@@ -27655,9 +27662,12 @@ class HtmlUtil {
|
|
27655
27662
|
col.style.cursor = '';
|
27656
27663
|
});
|
27657
27664
|
});
|
27658
|
-
});
|
27665
|
+
}); // cleanup cursor from drag to resize columns
|
27666
|
+
|
27659
27667
|
const rows = dom$h.elementChildren(tmp);
|
27660
27668
|
rows.forEach(row => {
|
27669
|
+
row.style.cursor = ''; //if tmp is row html, then this is a column
|
27670
|
+
|
27661
27671
|
const cols = dom$h.elementChildren(row);
|
27662
27672
|
cols.forEach(col => {
|
27663
27673
|
col.style.cursor = '';
|
@@ -78932,26 +78942,61 @@ class Rte {
|
|
78932
78942
|
|
78933
78943
|
const command = item.getAttribute('data-block'); //h1, h2, h3, h4, p, pre
|
78934
78944
|
|
78945
|
+
/*
|
78935
78946
|
let block = this.builder.doc.queryCommandValue('FormatBlock');
|
78936
78947
|
block = block.toLowerCase();
|
78937
|
-
|
78938
78948
|
if (block === 'pre') {
|
78939
|
-
|
78949
|
+
let elm = dom.textSelection();
|
78950
|
+
if(elm) {
|
78951
|
+
let pre = elm.closest('pre');
|
78952
|
+
if(pre) {
|
78953
|
+
let newnode = pre.cloneNode(true);
|
78954
|
+
let s = newnode.outerHTML.replace('<pre', '<' + command);
|
78955
|
+
s = s.replace('</pre>', '</' + command + '>');
|
78956
|
+
pre.outerHTML = s;
|
78957
|
+
}
|
78958
|
+
pre.focus();
|
78959
|
+
}
|
78960
|
+
} else {
|
78961
|
+
this.builder.doc.execCommand('formatBlock', false, '<' + command + '>'); //Needs contenteditable.
|
78962
|
+
}
|
78963
|
+
*/
|
78940
78964
|
|
78941
|
-
|
78942
|
-
|
78965
|
+
const selection = dom.getSelection();
|
78966
|
+
if (!selection) return;
|
78967
|
+
const anchorNode = selection.anchorNode;
|
78968
|
+
let container;
|
78969
|
+
|
78970
|
+
if (anchorNode) {
|
78971
|
+
container = anchorNode.nodeType !== Node.TEXT_NODE && anchorNode.nodeType !== Node.COMMENT_NODE ? anchorNode : anchorNode.parentElement;
|
78972
|
+
}
|
78973
|
+
|
78974
|
+
if (!container) return;
|
78975
|
+
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');
|
78976
|
+
|
78977
|
+
if (element) {
|
78978
|
+
// const tagName = element.tagName.toLowerCase();
|
78979
|
+
element.setAttribute('data-replacetagname', '1');
|
78980
|
+
const newElement = document.createElement(command); // Copy the attributes
|
78981
|
+
|
78982
|
+
for (var i = 0, l = element.attributes.length; i < l; ++i) {
|
78983
|
+
var nodeName = element.attributes.item(i).nodeName;
|
78984
|
+
var nodeValue = element.attributes.item(i).nodeValue;
|
78985
|
+
newElement.setAttribute(nodeName, nodeValue);
|
78986
|
+
} // move all elements in the other container.
|
78943
78987
|
|
78944
|
-
if (pre) {
|
78945
|
-
let newnode = pre.cloneNode(true);
|
78946
|
-
let s = newnode.outerHTML.replace('<pre', '<' + command);
|
78947
|
-
s = s.replace('</pre>', '</' + command + '>');
|
78948
|
-
pre.outerHTML = s;
|
78949
|
-
}
|
78950
78988
|
|
78951
|
-
|
78989
|
+
while (element.firstChild) {
|
78990
|
+
newElement.appendChild(element.firstChild);
|
78991
|
+
}
|
78992
|
+
|
78993
|
+
element.parentNode.replaceChild(newElement, element);
|
78994
|
+
const result = document.querySelector('[data-replacetagname="1"]');
|
78995
|
+
|
78996
|
+
if (result) {
|
78997
|
+
result.removeAttribute('data-replacetagname');
|
78998
|
+
dom.selectElementContents(result);
|
78952
78999
|
}
|
78953
|
-
} else {
|
78954
|
-
this.builder.doc.execCommand('formatBlock', false, '<' + command + '>'); //Needs contenteditable.
|
78955
79000
|
} //save selection
|
78956
79001
|
|
78957
79002
|
|
@@ -80591,7 +80636,7 @@ class Rte {
|
|
80591
80636
|
for (let i = 0; i < Object.keys(classes).length; i++) {
|
80592
80637
|
let className = Object.values(classes)[i];
|
80593
80638
|
|
80594
|
-
if (
|
80639
|
+
if (container.closest(`.${className}`)) {
|
80595
80640
|
if (num === '+') {
|
80596
80641
|
if (i + 1 === Object.keys(classes).length) return;
|
80597
80642
|
newClassName = Object.values(classes)[i + 1];
|