@wizishop/wizi-block 4.2.32-beta → 4.2.33-beta
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/bundles/wizishop-wizi-block.umd.js +118 -103
- package/bundles/wizishop-wizi-block.umd.js.map +1 -1
- package/bundles/wizishop-wizi-block.umd.min.js +1 -1
- package/bundles/wizishop-wizi-block.umd.min.js.map +1 -1
- package/esm2015/lib/shared/components/editorjs/editorjs.component.js +21 -12
- package/esm2015/lib/shared/components/editorjs/tools/inline/bold-tool.component.js +1 -1
- package/esm2015/lib/shared/components/editorjs/tools/inline/capitalize-tool.component.js +1 -1
- package/esm2015/lib/shared/components/editorjs/tools/inline/italic-tool.component.js +1 -1
- package/esm2015/lib/shared/components/editorjs/tools/inline/link-tool.component.js +1 -1
- package/esm2015/lib/shared/components/editorjs/tools/inline/strike-tool.component.js +1 -1
- package/esm2015/lib/shared/components/editorjs/tools/inline/subscript-tool.component.js +1 -1
- package/esm2015/lib/shared/components/editorjs/tools/inline/superscript-tool.component.js +1 -1
- package/esm2015/lib/shared/components/editorjs/tools/inline/tool-type/inline-style-tool.component.js +100 -64
- package/esm2015/lib/shared/components/editorjs/tools/inline/tool-type/text-tool.component.js +1 -18
- package/esm2015/lib/shared/components/editorjs/tools/inline/underline-tool.component.js +1 -1
- package/esm2015/lib/shared/components/editorjs/tools/paragraph/ordered-list-tool.component.js +2 -2
- package/esm2015/lib/shared/components/editorjs/tools/paragraph/quote-tool.component.js +2 -2
- package/esm2015/lib/shared/components/editorjs/tools/paragraph/text-align-tool.component.js +2 -2
- package/esm2015/lib/shared/components/editorjs/tools/paragraph/text-type-tool.component.js +2 -2
- package/esm2015/lib/shared/components/editorjs/tools/paragraph/tool-type/paragraph-style-tool.component.js +2 -18
- package/esm2015/lib/shared/components/editorjs/tools/paragraph/tool-type/text-edition.component.js +1 -1
- package/esm2015/lib/shared/components/editorjs/tools/paragraph/unordered-list-tool.component.js +2 -2
- package/esm2015/lib/shared/components/editorjs/tools/utils/editorjs-tool.component.js +8 -1
- package/fesm2015/wizishop-wizi-block.js +132 -113
- package/fesm2015/wizishop-wizi-block.js.map +1 -1
- package/lib/shared/components/editorjs/editorjs.component.d.ts +1 -0
- package/lib/shared/components/editorjs/tools/inline/bold-tool.component.d.ts +1 -1
- package/lib/shared/components/editorjs/tools/inline/capitalize-tool.component.d.ts +1 -1
- package/lib/shared/components/editorjs/tools/inline/italic-tool.component.d.ts +1 -1
- package/lib/shared/components/editorjs/tools/inline/link-tool.component.d.ts +1 -1
- package/lib/shared/components/editorjs/tools/inline/strike-tool.component.d.ts +1 -1
- package/lib/shared/components/editorjs/tools/inline/subscript-tool.component.d.ts +1 -1
- package/lib/shared/components/editorjs/tools/inline/superscript-tool.component.d.ts +1 -1
- package/lib/shared/components/editorjs/tools/inline/tool-type/inline-style-tool.component.d.ts +2 -0
- package/lib/shared/components/editorjs/tools/inline/tool-type/text-tool.component.d.ts +0 -1
- package/lib/shared/components/editorjs/tools/inline/underline-tool.component.d.ts +1 -1
- package/lib/shared/components/editorjs/tools/paragraph/tool-type/paragraph-style-tool.component.d.ts +0 -1
- package/lib/shared/components/editorjs/tools/utils/editorjs-tool.component.d.ts +2 -0
- package/package.json +1 -1
- package/wizishop-wizi-block.metadata.json +1 -1
|
@@ -18651,6 +18651,13 @@ class EditorJSTool {
|
|
|
18651
18651
|
const selection = this.currentSelection ? this.currentSelection : this.getSelection();
|
|
18652
18652
|
return selection.anchorNode.parentElement.closest('.editorJs');
|
|
18653
18653
|
}
|
|
18654
|
+
findParentModifier() {
|
|
18655
|
+
if (!this.parentEditor) {
|
|
18656
|
+
this.parentEditor = this.findParentEditor();
|
|
18657
|
+
}
|
|
18658
|
+
return (this.parentEditor.querySelectorAll('.ce-block')[this.api.blocks.getCurrentBlockIndex()].querySelector('.ce-paragraph')
|
|
18659
|
+
.children[0]);
|
|
18660
|
+
}
|
|
18654
18661
|
clear() {
|
|
18655
18662
|
resetBlockFocus(this.parentEditor);
|
|
18656
18663
|
}
|
|
@@ -18731,33 +18738,28 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
18731
18738
|
: anchorNode.parentElement;
|
|
18732
18739
|
const sameSelection = container && container.innerText === selection.toString();
|
|
18733
18740
|
yield this.saveInlineSelection(container, true);
|
|
18734
|
-
console.log('
|
|
18741
|
+
console.log('=== inline tool execCommandStyle method ===');
|
|
18735
18742
|
console.log(this.hasStyle(container));
|
|
18736
|
-
|
|
18737
|
-
|
|
18738
|
-
|
|
18739
|
-
|
|
18743
|
+
// Link delete exception
|
|
18744
|
+
if (this.linkDeletion) {
|
|
18745
|
+
yield this.replaceLink(selection, this.hasStyle(container));
|
|
18746
|
+
}
|
|
18747
|
+
else {
|
|
18748
|
+
if (sameSelection &&
|
|
18749
|
+
!this.isContainer(this.textContainers, container) &&
|
|
18750
|
+
this.hasStyle(container) &&
|
|
18751
|
+
selection.toString() === this.hasStyle(container).innerText) {
|
|
18752
|
+
console.log('-> update selection');
|
|
18753
|
+
yield this.updateSelection(selection, this.hasStyle(container), action, this.textContainers);
|
|
18740
18754
|
}
|
|
18741
18755
|
else {
|
|
18742
|
-
|
|
18743
|
-
|
|
18744
|
-
this.hasStyle(container) &&
|
|
18745
|
-
selection.toString() === this.hasStyle(container).innerText) {
|
|
18746
|
-
console.log('update');
|
|
18747
|
-
yield this.updateSelection(selection, this.hasStyle(container), action, this.textContainers);
|
|
18748
|
-
}
|
|
18749
|
-
else {
|
|
18750
|
-
console.log('replace');
|
|
18751
|
-
yield this.replaceSelection(this.getMostDescendantChild(container), action, selection, this.textContainers);
|
|
18752
|
-
}
|
|
18753
|
-
}
|
|
18754
|
-
yield this.cleanupContainer(selection, container, true);
|
|
18755
|
-
if (this.modifiedContent) {
|
|
18756
|
-
yield this.resetInlineSelection(container, true);
|
|
18756
|
+
console.log('-> replace selection');
|
|
18757
|
+
yield this.replaceSelection(this.getMostDescendantChild(container), action, selection, this.textContainers);
|
|
18757
18758
|
}
|
|
18758
18759
|
}
|
|
18759
|
-
|
|
18760
|
-
|
|
18760
|
+
yield this.cleanupContainer(selection, container, true);
|
|
18761
|
+
if (this.modifiedContent) {
|
|
18762
|
+
yield this.resetInlineSelection(container, true);
|
|
18761
18763
|
}
|
|
18762
18764
|
});
|
|
18763
18765
|
}
|
|
@@ -18801,11 +18803,11 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
18801
18803
|
replaceSelection(container, action, selection, containers) {
|
|
18802
18804
|
var _a;
|
|
18803
18805
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18804
|
-
let parentContainer = this.hasStyle(container);
|
|
18805
18806
|
const focusNode = selection.focusNode;
|
|
18806
18807
|
let offsetContainer = focusNode.nodeType !== Node.TEXT_NODE && focusNode.nodeType !== Node.COMMENT_NODE
|
|
18807
18808
|
? focusNode
|
|
18808
18809
|
: focusNode.parentElement;
|
|
18810
|
+
let parentContainer = this.hasStyle(container);
|
|
18809
18811
|
let offsetParentContainer = this.hasStyle(offsetContainer);
|
|
18810
18812
|
if (parentContainer &&
|
|
18811
18813
|
parentContainer === offsetParentContainer &&
|
|
@@ -18834,8 +18836,6 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
18834
18836
|
let currentParentElement = container;
|
|
18835
18837
|
if (parentContainer.contains(currentParentElement)) {
|
|
18836
18838
|
while (currentParentElement !== parentContainer) {
|
|
18837
|
-
console.warn('currentParentElement');
|
|
18838
|
-
console.log(currentParentElement);
|
|
18839
18839
|
let tmpElement = document.createElement(currentParentElement.tagName);
|
|
18840
18840
|
tmpElement = this.setInlineStyle(currentParentElement, tmpElement);
|
|
18841
18841
|
tmpElement.appendChild(currentElementToAppend);
|
|
@@ -18867,6 +18867,7 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
18867
18867
|
let fragmentElement = document.createElement('div');
|
|
18868
18868
|
let newElement = yield this.createElement(container, action, containers);
|
|
18869
18869
|
let elementToAppend = newElement;
|
|
18870
|
+
console.log(newElement);
|
|
18870
18871
|
fragmentElement.append(fragment);
|
|
18871
18872
|
if (((_a = fragmentElement.children) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
|
|
18872
18873
|
this.textContainers.split(',').indexOf(fragmentElement.children[0].tagName.toLowerCase()) > -1) {
|
|
@@ -19038,6 +19039,26 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
19038
19039
|
}
|
|
19039
19040
|
});
|
|
19040
19041
|
}
|
|
19042
|
+
parentHasStyle(currentElement, referenceElement) {
|
|
19043
|
+
// Link exception
|
|
19044
|
+
if (!currentElement || referenceElement.tagName.toLowerCase() === 'a' || referenceElement.tagName.toLowerCase() === 'div') {
|
|
19045
|
+
return false;
|
|
19046
|
+
}
|
|
19047
|
+
if (referenceElement.tagName.toLowerCase() !== 'span' &&
|
|
19048
|
+
referenceElement.tagName.toLowerCase() === currentElement.tagName.toLowerCase()) {
|
|
19049
|
+
return true;
|
|
19050
|
+
}
|
|
19051
|
+
if (Object.keys(this.getInlineStyle(currentElement)).length > 0 && this.identicalInlineStyle(currentElement, referenceElement)) {
|
|
19052
|
+
return true;
|
|
19053
|
+
}
|
|
19054
|
+
if (currentElement.classList.length > 0 && this.identicalClassList(currentElement, referenceElement)) {
|
|
19055
|
+
return true;
|
|
19056
|
+
}
|
|
19057
|
+
if (currentElement.parentElement && currentElement.parentElement.tagName.toLowerCase() !== 'div') {
|
|
19058
|
+
return this.parentHasStyle(currentElement.parentElement, referenceElement);
|
|
19059
|
+
}
|
|
19060
|
+
return false;
|
|
19061
|
+
}
|
|
19041
19062
|
cleanupContainer(selection, container, firstTimeCall) {
|
|
19042
19063
|
var _a;
|
|
19043
19064
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -19064,47 +19085,57 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
19064
19085
|
const children = Array.from(parentContainer.childNodes);
|
|
19065
19086
|
if ((children === null || children === void 0 ? void 0 : children.length) > 0) {
|
|
19066
19087
|
for (var currentNode = children[0]; currentNode; currentNode = currentNode.nextSibling) {
|
|
19067
|
-
if (!currentNode.textContent || currentNode.textContent.length === 0) {
|
|
19088
|
+
if ((!currentNode.textContent || currentNode.textContent.length === 0) || (currentNode.nodeType === Node.ELEMENT_NODE && currentNode.innerText.length === 0)) {
|
|
19089
|
+
let previousSibling = currentNode.previousSibling;
|
|
19068
19090
|
parentContainer.removeChild(currentNode);
|
|
19091
|
+
currentNode = previousSibling;
|
|
19069
19092
|
}
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
currentNode.nodeType === Node.ELEMENT_NODE &&
|
|
19078
|
-
currentNode.nextSibling.nodeType === Node.ELEMENT_NODE) {
|
|
19079
|
-
let currentElement = currentNode;
|
|
19080
|
-
let nextElement = currentNode.nextSibling;
|
|
19081
|
-
if (this.identicalInlineStyle(currentElement, nextElement) &&
|
|
19082
|
-
currentElement.tagName.toLowerCase() === nextElement.tagName.toLowerCase() &&
|
|
19083
|
-
this.identicalClassList(currentElement, nextElement) &&
|
|
19084
|
-
!currentElement.hasAttributes() &&
|
|
19085
|
-
!nextElement.hasAttributes()) {
|
|
19086
|
-
currentElement.innerHTML += nextElement.innerHTML;
|
|
19087
|
-
nextElement.remove();
|
|
19088
|
-
this.modifiedContent = true;
|
|
19089
|
-
}
|
|
19090
|
-
else {
|
|
19091
|
-
identicalElements = false;
|
|
19092
|
-
}
|
|
19093
|
+
if (currentNode.nodeType === Node.ELEMENT_NODE &&
|
|
19094
|
+
this.parentHasStyle(currentNode.parentElement, currentNode)) {
|
|
19095
|
+
let currentNodeFirstChild = currentNode;
|
|
19096
|
+
let nextCurrentElement = currentNode.firstChild;
|
|
19097
|
+
while (currentNode.firstChild) {
|
|
19098
|
+
parentContainer.insertBefore(currentNode.firstChild, currentNodeFirstChild.nextSibling);
|
|
19099
|
+
currentNodeFirstChild = currentNodeFirstChild.nextSibling;
|
|
19093
19100
|
}
|
|
19094
|
-
|
|
19095
|
-
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19101
|
+
parentContainer.removeChild(currentNode);
|
|
19102
|
+
currentNode = nextCurrentElement;
|
|
19103
|
+
}
|
|
19104
|
+
let identicalElements = true;
|
|
19105
|
+
while (identicalElements &&
|
|
19106
|
+
currentNode.nextSibling &&
|
|
19107
|
+
currentNode.nodeType === Node.ELEMENT_NODE &&
|
|
19108
|
+
currentNode.nextSibling.nodeType === Node.ELEMENT_NODE) {
|
|
19109
|
+
let currentElement = currentNode;
|
|
19110
|
+
let nextElement = currentNode.nextSibling;
|
|
19111
|
+
if (this.identicalInlineStyle(currentElement, nextElement) &&
|
|
19112
|
+
currentElement.tagName.toLowerCase() === nextElement.tagName.toLowerCase() &&
|
|
19113
|
+
this.identicalClassList(currentElement, nextElement) &&
|
|
19114
|
+
this.identicalAttributes(currentElement, nextElement)) {
|
|
19115
|
+
currentElement.innerHTML += nextElement.innerHTML;
|
|
19116
|
+
nextElement.remove();
|
|
19105
19117
|
this.modifiedContent = true;
|
|
19106
19118
|
}
|
|
19107
|
-
|
|
19119
|
+
else {
|
|
19120
|
+
identicalElements = false;
|
|
19121
|
+
}
|
|
19122
|
+
}
|
|
19123
|
+
if (currentNode.nodeType === Node.ELEMENT_NODE &&
|
|
19124
|
+
currentNode.tagName.toLowerCase() === 'span' &&
|
|
19125
|
+
Object.keys(this.getInlineStyle(currentNode)).length === 0 &&
|
|
19126
|
+
(!currentNode.classList || currentNode.classList.length === 0) &&
|
|
19127
|
+
this.hasNoAttributes(currentNode)) {
|
|
19128
|
+
let currentNodeFirstChild = currentNode;
|
|
19129
|
+
while (currentNode.firstChild) {
|
|
19130
|
+
currentNodeFirstChild.parentElement.insertBefore(currentNode.firstChild, currentNodeFirstChild.nextSibling);
|
|
19131
|
+
currentNodeFirstChild = currentNodeFirstChild.nextSibling;
|
|
19132
|
+
}
|
|
19133
|
+
currentNode.remove();
|
|
19134
|
+
this.modifiedContent = true;
|
|
19135
|
+
}
|
|
19136
|
+
currentNode.normalize();
|
|
19137
|
+
if (currentNode.childNodes.length > 0) {
|
|
19138
|
+
yield this.cleanupContainer(selection, currentNode, false);
|
|
19108
19139
|
}
|
|
19109
19140
|
}
|
|
19110
19141
|
}
|
|
@@ -19124,6 +19155,17 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
19124
19155
|
return ([...currentElement.classList].every((classList) => nextElement.classList.contains(classList)) &&
|
|
19125
19156
|
[...nextElement.classList].every((classList) => currentElement.classList.contains(classList)));
|
|
19126
19157
|
}
|
|
19158
|
+
identicalAttributes(currentElement, nextElement) {
|
|
19159
|
+
let currentElementAttributes = currentElement.getAttributeNames();
|
|
19160
|
+
currentElementAttributes.forEach(attribute => {
|
|
19161
|
+
if (attribute !== 'style') {
|
|
19162
|
+
if (!nextElement.getAttribute(attribute) || nextElement.getAttribute(attribute) !== currentElement.getAttribute(attribute)) {
|
|
19163
|
+
return false;
|
|
19164
|
+
}
|
|
19165
|
+
}
|
|
19166
|
+
});
|
|
19167
|
+
return true;
|
|
19168
|
+
}
|
|
19127
19169
|
identicalInlineStyle(currentElement, nextElement) {
|
|
19128
19170
|
const currentElementInlineStyle = this.getInlineStyle(currentElement);
|
|
19129
19171
|
const nextElementInlineStyle = this.getInlineStyle(nextElement);
|
|
@@ -19177,9 +19219,10 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
19177
19219
|
let nextNode = container.firstChild;
|
|
19178
19220
|
while (nextNode && (!this.foundAnchorNode || !this.foundFocusNode)) {
|
|
19179
19221
|
if (nextNode === this.selectedAnchorNode) {
|
|
19180
|
-
this.foundAnchorNode = true;
|
|
19181
|
-
this.foundAnchorOffset += this.anchorOffset;
|
|
19182
19222
|
let selection = this.getSelection();
|
|
19223
|
+
const isLTR = this.isAnchorBeforeFocus(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
|
|
19224
|
+
this.foundAnchorNode = true;
|
|
19225
|
+
this.foundAnchorOffset += isLTR ? this.anchorOffset : this.focusOffset;
|
|
19183
19226
|
let range = this.getRangeObject(selection);
|
|
19184
19227
|
const currentFragment = range.cloneContents();
|
|
19185
19228
|
const currentElement = document.createElement('span');
|
|
@@ -20559,7 +20602,7 @@ class ParagraphStyleTool extends EditorJSTool {
|
|
|
20559
20602
|
if (!anchorNode) {
|
|
20560
20603
|
return;
|
|
20561
20604
|
}
|
|
20562
|
-
let parentModifier = this.findParentModifier(
|
|
20605
|
+
let parentModifier = this.findParentModifier();
|
|
20563
20606
|
try {
|
|
20564
20607
|
if (this.tag.toLowerCase() !== 'span') {
|
|
20565
20608
|
this.changeContainerTag(parentModifier, selection);
|
|
@@ -20694,22 +20737,6 @@ class ParagraphStyleTool extends EditorJSTool {
|
|
|
20694
20737
|
container.className += (container.className.length > 0 ? ' ' : '') + this.classToApply;
|
|
20695
20738
|
}
|
|
20696
20739
|
}
|
|
20697
|
-
findParentModifier(element) {
|
|
20698
|
-
let currentElement = element;
|
|
20699
|
-
if (currentElement.tagName.toLowerCase() === 'div') {
|
|
20700
|
-
if (currentElement.classList.contains('ce-paragraph')) {
|
|
20701
|
-
return currentElement.children[0];
|
|
20702
|
-
}
|
|
20703
|
-
return currentElement.closest('.codex-editor__redactor').querySelector('.ce-paragraph').children[0];
|
|
20704
|
-
}
|
|
20705
|
-
while (this.modifiers.split(',').indexOf(currentElement.tagName.toLowerCase()) === -1) {
|
|
20706
|
-
if (currentElement.tagName.toLowerCase() === 'div') {
|
|
20707
|
-
return null;
|
|
20708
|
-
}
|
|
20709
|
-
currentElement = currentElement.parentElement;
|
|
20710
|
-
}
|
|
20711
|
-
return currentElement;
|
|
20712
|
-
}
|
|
20713
20740
|
}
|
|
20714
20741
|
var listApi = null;
|
|
20715
20742
|
var listEditor = null;
|
|
@@ -21006,7 +21033,7 @@ class TextTypeTool extends ParagraphTextTool {
|
|
|
21006
21033
|
if (!isBlockFocused) {
|
|
21007
21034
|
setBlockFocus(this.parentEditor);
|
|
21008
21035
|
}
|
|
21009
|
-
const parentModifier = this.findParentModifier(
|
|
21036
|
+
const parentModifier = this.findParentModifier();
|
|
21010
21037
|
if (!parentModifier) {
|
|
21011
21038
|
return false;
|
|
21012
21039
|
}
|
|
@@ -21281,7 +21308,7 @@ class TextAlignTool extends ParagraphTextTool {
|
|
|
21281
21308
|
if (!isBlockFocused) {
|
|
21282
21309
|
setBlockFocus(this.parentEditor);
|
|
21283
21310
|
}
|
|
21284
|
-
const parentModifier = this.findParentModifier(
|
|
21311
|
+
const parentModifier = this.findParentModifier();
|
|
21285
21312
|
if (!parentModifier) {
|
|
21286
21313
|
return false;
|
|
21287
21314
|
}
|
|
@@ -21385,7 +21412,7 @@ class UnorderedListTool extends ParagraphStyleTool {
|
|
|
21385
21412
|
if (!isBlockFocused) {
|
|
21386
21413
|
setBlockFocus(this.parentEditor);
|
|
21387
21414
|
}
|
|
21388
|
-
const parentModifier = this.findParentModifier(
|
|
21415
|
+
const parentModifier = this.findParentModifier();
|
|
21389
21416
|
if (!parentModifier) {
|
|
21390
21417
|
return false;
|
|
21391
21418
|
}
|
|
@@ -21450,7 +21477,7 @@ class OrderedListTool extends ParagraphStyleTool {
|
|
|
21450
21477
|
if (!isBlockFocused) {
|
|
21451
21478
|
setBlockFocus(this.parentEditor);
|
|
21452
21479
|
}
|
|
21453
|
-
const parentModifier = this.findParentModifier(
|
|
21480
|
+
const parentModifier = this.findParentModifier();
|
|
21454
21481
|
if (!parentModifier) {
|
|
21455
21482
|
return false;
|
|
21456
21483
|
}
|
|
@@ -21515,7 +21542,7 @@ class QuoteTool extends ParagraphStyleTool {
|
|
|
21515
21542
|
if (!isBlockFocused) {
|
|
21516
21543
|
setBlockFocus(this.parentEditor);
|
|
21517
21544
|
}
|
|
21518
|
-
const parentModifier = this.findParentModifier(
|
|
21545
|
+
const parentModifier = this.findParentModifier();
|
|
21519
21546
|
if (!parentModifier) {
|
|
21520
21547
|
return false;
|
|
21521
21548
|
}
|
|
@@ -22050,23 +22077,6 @@ class InlineTextTool extends InlineStyleTool {
|
|
|
22050
22077
|
return true;
|
|
22051
22078
|
}
|
|
22052
22079
|
}
|
|
22053
|
-
findParentModifier(element) {
|
|
22054
|
-
const modifiers = 'h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote';
|
|
22055
|
-
let currentElement = element;
|
|
22056
|
-
if (currentElement.tagName.toLowerCase() === 'div') {
|
|
22057
|
-
if (currentElement.classList.contains('ce-paragraph')) {
|
|
22058
|
-
return currentElement.firstElementChild;
|
|
22059
|
-
}
|
|
22060
|
-
return currentElement.querySelector('.ce-paragraph').children[0];
|
|
22061
|
-
}
|
|
22062
|
-
while (modifiers.split(',').indexOf(currentElement.tagName.toLowerCase()) === -1) {
|
|
22063
|
-
if (currentElement.tagName.toLowerCase() === 'div') {
|
|
22064
|
-
return null;
|
|
22065
|
-
}
|
|
22066
|
-
currentElement = currentElement.parentElement;
|
|
22067
|
-
}
|
|
22068
|
-
return currentElement;
|
|
22069
|
-
}
|
|
22070
22080
|
}
|
|
22071
22081
|
|
|
22072
22082
|
// @dynamic
|
|
@@ -22765,6 +22775,7 @@ class EditorJsComponent {
|
|
|
22765
22775
|
this.timeoutHandle = null;
|
|
22766
22776
|
this.timeoutTextEditionHandle = null;
|
|
22767
22777
|
this.onChangeTimeoutHandle = null;
|
|
22778
|
+
this.editorInitialized = false;
|
|
22768
22779
|
this.wrapperTags = 'h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote';
|
|
22769
22780
|
}
|
|
22770
22781
|
ngOnInit() {
|
|
@@ -22826,7 +22837,7 @@ class EditorJsComponent {
|
|
|
22826
22837
|
clearTimeout(this.onChangeTimeoutHandle);
|
|
22827
22838
|
this.onChangeTimeoutHandle = setTimeout(() => {
|
|
22828
22839
|
this.contentChanged(api, event);
|
|
22829
|
-
},
|
|
22840
|
+
}, 200);
|
|
22830
22841
|
},
|
|
22831
22842
|
i18n: this.getI18nDictionnary(),
|
|
22832
22843
|
});
|
|
@@ -22837,12 +22848,10 @@ class EditorJsComponent {
|
|
|
22837
22848
|
this.content = content;
|
|
22838
22849
|
this.applyContent();
|
|
22839
22850
|
this.checkSingleChild();
|
|
22840
|
-
|
|
22841
|
-
|
|
22842
|
-
|
|
22843
|
-
|
|
22844
|
-
});
|
|
22845
|
-
}, 0);
|
|
22851
|
+
const editorElement = document.getElementById('editorJs-' + this.uuid);
|
|
22852
|
+
editorElement.addEventListener('focusin', () => {
|
|
22853
|
+
setlistApiEditor(this.editor, editorElement);
|
|
22854
|
+
});
|
|
22846
22855
|
});
|
|
22847
22856
|
}
|
|
22848
22857
|
catch (reason) {
|
|
@@ -22853,7 +22862,6 @@ class EditorJsComponent {
|
|
|
22853
22862
|
ngOnDestroy() {
|
|
22854
22863
|
const editorName = 'editorJs-' + this.uuid;
|
|
22855
22864
|
this.deleteSavedEditorContent(editorName);
|
|
22856
|
-
this.deleteSavedEditorContent(editorName);
|
|
22857
22865
|
this.editor.destroy();
|
|
22858
22866
|
}
|
|
22859
22867
|
handleDefaultContentTranslation() {
|
|
@@ -22870,7 +22878,13 @@ class EditorJsComponent {
|
|
|
22870
22878
|
.save()
|
|
22871
22879
|
.then(() => {
|
|
22872
22880
|
this.content = this.getEditorContent();
|
|
22873
|
-
|
|
22881
|
+
if (!this.editorInitialized) {
|
|
22882
|
+
this.handleSaveEditor(this.content, this.uuid);
|
|
22883
|
+
this.editorInitialized = true;
|
|
22884
|
+
}
|
|
22885
|
+
else {
|
|
22886
|
+
this.saveEditorContent(this.content);
|
|
22887
|
+
}
|
|
22874
22888
|
this.contentChange.emit(this.content);
|
|
22875
22889
|
})
|
|
22876
22890
|
.catch((error) => {
|
|
@@ -23012,11 +23026,11 @@ class EditorJsComponent {
|
|
|
23012
23026
|
}
|
|
23013
23027
|
return null;
|
|
23014
23028
|
}
|
|
23015
|
-
saveEditorContent(data
|
|
23029
|
+
saveEditorContent(data) {
|
|
23016
23030
|
if (!isTextEditionTool) {
|
|
23017
23031
|
clearTimeout(this.timeoutHandle);
|
|
23018
23032
|
this.timeoutHandle = setTimeout(() => {
|
|
23019
|
-
this.handleSaveEditor(data, uuid);
|
|
23033
|
+
this.handleSaveEditor(data, this.uuid);
|
|
23020
23034
|
}, 2000);
|
|
23021
23035
|
}
|
|
23022
23036
|
else {
|
|
@@ -23032,6 +23046,10 @@ class EditorJsComponent {
|
|
|
23032
23046
|
let savedDataIndex = this.getSavedEditorContent(editorName + '-index')
|
|
23033
23047
|
? parseInt(this.getSavedEditorContent(editorName + '-index'))
|
|
23034
23048
|
: -1;
|
|
23049
|
+
if (!this.editorInitialized) {
|
|
23050
|
+
savedData = null;
|
|
23051
|
+
savedDataIndex = -1;
|
|
23052
|
+
}
|
|
23035
23053
|
let parsedSavedData = [];
|
|
23036
23054
|
if (savedData) {
|
|
23037
23055
|
parsedSavedData = JSON.parse(savedData);
|
|
@@ -23053,6 +23071,7 @@ class EditorJsComponent {
|
|
|
23053
23071
|
}
|
|
23054
23072
|
deleteSavedEditorContent(name) {
|
|
23055
23073
|
localStorage.removeItem(name);
|
|
23074
|
+
localStorage.removeItem(name + '-index');
|
|
23056
23075
|
}
|
|
23057
23076
|
}
|
|
23058
23077
|
EditorJsComponent.decorators = [
|