@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
|
@@ -20355,6 +20355,13 @@
|
|
|
20355
20355
|
var selection = this.currentSelection ? this.currentSelection : this.getSelection();
|
|
20356
20356
|
return selection.anchorNode.parentElement.closest('.editorJs');
|
|
20357
20357
|
};
|
|
20358
|
+
EditorJSTool.prototype.findParentModifier = function () {
|
|
20359
|
+
if (!this.parentEditor) {
|
|
20360
|
+
this.parentEditor = this.findParentEditor();
|
|
20361
|
+
}
|
|
20362
|
+
return (this.parentEditor.querySelectorAll('.ce-block')[this.api.blocks.getCurrentBlockIndex()].querySelector('.ce-paragraph')
|
|
20363
|
+
.children[0]);
|
|
20364
|
+
};
|
|
20358
20365
|
EditorJSTool.prototype.clear = function () {
|
|
20359
20366
|
resetBlockFocus(this.parentEditor);
|
|
20360
20367
|
};
|
|
@@ -20422,7 +20429,7 @@
|
|
|
20422
20429
|
}
|
|
20423
20430
|
InlineStyleTool.prototype.execCommandStyle = function (action) {
|
|
20424
20431
|
return __awaiter(this, void 0, void 0, function () {
|
|
20425
|
-
var selection, anchorNode, container, sameSelection
|
|
20432
|
+
var selection, anchorNode, container, sameSelection;
|
|
20426
20433
|
return __generator(this, function (_c) {
|
|
20427
20434
|
switch (_c.label) {
|
|
20428
20435
|
case 0:
|
|
@@ -20444,46 +20451,38 @@
|
|
|
20444
20451
|
return [4 /*yield*/, this.saveInlineSelection(container, true)];
|
|
20445
20452
|
case 1:
|
|
20446
20453
|
_c.sent();
|
|
20447
|
-
console.log('
|
|
20454
|
+
console.log('=== inline tool execCommandStyle method ===');
|
|
20448
20455
|
console.log(this.hasStyle(container));
|
|
20449
|
-
|
|
20450
|
-
case 2:
|
|
20451
|
-
_c.trys.push([2, 12, , 13]);
|
|
20452
|
-
if (!this.linkDeletion) return [3 /*break*/, 4];
|
|
20456
|
+
if (!this.linkDeletion) return [3 /*break*/, 3];
|
|
20453
20457
|
return [4 /*yield*/, this.replaceLink(selection, this.hasStyle(container))];
|
|
20454
|
-
case
|
|
20458
|
+
case 2:
|
|
20455
20459
|
_c.sent();
|
|
20456
|
-
return [3 /*break*/,
|
|
20457
|
-
case
|
|
20460
|
+
return [3 /*break*/, 7];
|
|
20461
|
+
case 3:
|
|
20458
20462
|
if (!(sameSelection &&
|
|
20459
20463
|
!this.isContainer(this.textContainers, container) &&
|
|
20460
20464
|
this.hasStyle(container) &&
|
|
20461
|
-
selection.toString() === this.hasStyle(container).innerText)) return [3 /*break*/,
|
|
20462
|
-
console.log('update');
|
|
20465
|
+
selection.toString() === this.hasStyle(container).innerText)) return [3 /*break*/, 5];
|
|
20466
|
+
console.log('-> update selection');
|
|
20463
20467
|
return [4 /*yield*/, this.updateSelection(selection, this.hasStyle(container), action, this.textContainers)];
|
|
20464
|
-
case
|
|
20468
|
+
case 4:
|
|
20465
20469
|
_c.sent();
|
|
20466
|
-
return [3 /*break*/,
|
|
20467
|
-
case
|
|
20468
|
-
console.log('replace');
|
|
20470
|
+
return [3 /*break*/, 7];
|
|
20471
|
+
case 5:
|
|
20472
|
+
console.log('-> replace selection');
|
|
20469
20473
|
return [4 /*yield*/, this.replaceSelection(this.getMostDescendantChild(container), action, selection, this.textContainers)];
|
|
20470
|
-
case
|
|
20474
|
+
case 6:
|
|
20471
20475
|
_c.sent();
|
|
20472
|
-
_c.label =
|
|
20473
|
-
case
|
|
20474
|
-
case
|
|
20476
|
+
_c.label = 7;
|
|
20477
|
+
case 7: return [4 /*yield*/, this.cleanupContainer(selection, container, true)];
|
|
20478
|
+
case 8:
|
|
20475
20479
|
_c.sent();
|
|
20476
|
-
if (!this.modifiedContent) return [3 /*break*/,
|
|
20480
|
+
if (!this.modifiedContent) return [3 /*break*/, 10];
|
|
20477
20481
|
return [4 /*yield*/, this.resetInlineSelection(container, true)];
|
|
20478
|
-
case
|
|
20482
|
+
case 9:
|
|
20479
20483
|
_c.sent();
|
|
20480
|
-
_c.label =
|
|
20481
|
-
case
|
|
20482
|
-
case 12:
|
|
20483
|
-
error_1 = _c.sent();
|
|
20484
|
-
console.warn('Inline Tool Error : ' + error_1);
|
|
20485
|
-
return [3 /*break*/, 13];
|
|
20486
|
-
case 13: return [2 /*return*/];
|
|
20484
|
+
_c.label = 10;
|
|
20485
|
+
case 10: return [2 /*return*/];
|
|
20487
20486
|
}
|
|
20488
20487
|
});
|
|
20489
20488
|
});
|
|
@@ -20540,15 +20539,15 @@
|
|
|
20540
20539
|
InlineStyleTool.prototype.replaceSelection = function (container, action, selection, containers) {
|
|
20541
20540
|
var _a;
|
|
20542
20541
|
return __awaiter(this, void 0, void 0, function () {
|
|
20543
|
-
var
|
|
20542
|
+
var focusNode, offsetContainer, parentContainer, offsetParentContainer, range, currentFragment, currentElement_1, currentElementToAppend, currentParentElement, tmpElement, isLTR, selectionFocusOffset, selectionFocusNode, newSelection, preRange, preFragment, newElement, range, fragment, fragmentElement, newElement_2, elementToAppend;
|
|
20544
20543
|
return __generator(this, function (_c) {
|
|
20545
20544
|
switch (_c.label) {
|
|
20546
20545
|
case 0:
|
|
20547
|
-
parentContainer = this.hasStyle(container);
|
|
20548
20546
|
focusNode = selection.focusNode;
|
|
20549
20547
|
offsetContainer = focusNode.nodeType !== Node.TEXT_NODE && focusNode.nodeType !== Node.COMMENT_NODE
|
|
20550
20548
|
? focusNode
|
|
20551
20549
|
: focusNode.parentElement;
|
|
20550
|
+
parentContainer = this.hasStyle(container);
|
|
20552
20551
|
offsetParentContainer = this.hasStyle(offsetContainer);
|
|
20553
20552
|
if (!(parentContainer &&
|
|
20554
20553
|
parentContainer === offsetParentContainer &&
|
|
@@ -20580,8 +20579,6 @@
|
|
|
20580
20579
|
currentParentElement = container;
|
|
20581
20580
|
if (parentContainer.contains(currentParentElement)) {
|
|
20582
20581
|
while (currentParentElement !== parentContainer) {
|
|
20583
|
-
console.warn('currentParentElement');
|
|
20584
|
-
console.log(currentParentElement);
|
|
20585
20582
|
tmpElement = document.createElement(currentParentElement.tagName);
|
|
20586
20583
|
tmpElement = this.setInlineStyle(currentParentElement, tmpElement);
|
|
20587
20584
|
tmpElement.appendChild(currentElementToAppend);
|
|
@@ -20615,6 +20612,7 @@
|
|
|
20615
20612
|
case 4:
|
|
20616
20613
|
newElement_2 = _c.sent();
|
|
20617
20614
|
elementToAppend = newElement_2;
|
|
20615
|
+
console.log(newElement_2);
|
|
20618
20616
|
fragmentElement.append(fragment);
|
|
20619
20617
|
if (((_a = fragmentElement.children) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
|
|
20620
20618
|
this.textContainers.split(',').indexOf(fragmentElement.children[0].tagName.toLowerCase()) > -1) {
|
|
@@ -20834,10 +20832,30 @@
|
|
|
20834
20832
|
});
|
|
20835
20833
|
});
|
|
20836
20834
|
};
|
|
20835
|
+
InlineStyleTool.prototype.parentHasStyle = function (currentElement, referenceElement) {
|
|
20836
|
+
// Link exception
|
|
20837
|
+
if (!currentElement || referenceElement.tagName.toLowerCase() === 'a' || referenceElement.tagName.toLowerCase() === 'div') {
|
|
20838
|
+
return false;
|
|
20839
|
+
}
|
|
20840
|
+
if (referenceElement.tagName.toLowerCase() !== 'span' &&
|
|
20841
|
+
referenceElement.tagName.toLowerCase() === currentElement.tagName.toLowerCase()) {
|
|
20842
|
+
return true;
|
|
20843
|
+
}
|
|
20844
|
+
if (Object.keys(this.getInlineStyle(currentElement)).length > 0 && this.identicalInlineStyle(currentElement, referenceElement)) {
|
|
20845
|
+
return true;
|
|
20846
|
+
}
|
|
20847
|
+
if (currentElement.classList.length > 0 && this.identicalClassList(currentElement, referenceElement)) {
|
|
20848
|
+
return true;
|
|
20849
|
+
}
|
|
20850
|
+
if (currentElement.parentElement && currentElement.parentElement.tagName.toLowerCase() !== 'div') {
|
|
20851
|
+
return this.parentHasStyle(currentElement.parentElement, referenceElement);
|
|
20852
|
+
}
|
|
20853
|
+
return false;
|
|
20854
|
+
};
|
|
20837
20855
|
InlineStyleTool.prototype.cleanupContainer = function (selection, container, firstTimeCall) {
|
|
20838
20856
|
var _a;
|
|
20839
20857
|
return __awaiter(this, void 0, void 0, function () {
|
|
20840
|
-
var parentContainer, parentFound, children, currentNode, identicalElements, currentElement, nextElement, currentNodeFirstChild;
|
|
20858
|
+
var parentContainer, parentFound, children, currentNode, previousSibling, currentNodeFirstChild, nextCurrentElement, identicalElements, currentElement, nextElement, currentNodeFirstChild;
|
|
20841
20859
|
return __generator(this, function (_c) {
|
|
20842
20860
|
switch (_c.label) {
|
|
20843
20861
|
case 0:
|
|
@@ -20861,21 +20879,27 @@
|
|
|
20861
20879
|
}
|
|
20862
20880
|
parentContainer.normalize();
|
|
20863
20881
|
children = Array.from(parentContainer.childNodes);
|
|
20864
|
-
if (!((children === null || children === void 0 ? void 0 : children.length) > 0)) return [3 /*break*/,
|
|
20882
|
+
if (!((children === null || children === void 0 ? void 0 : children.length) > 0)) return [3 /*break*/, 4];
|
|
20865
20883
|
currentNode = children[0];
|
|
20866
20884
|
_c.label = 1;
|
|
20867
20885
|
case 1:
|
|
20868
|
-
if (!currentNode) return [3 /*break*/,
|
|
20869
|
-
if (
|
|
20870
|
-
|
|
20871
|
-
|
|
20872
|
-
|
|
20873
|
-
|
|
20874
|
-
|
|
20875
|
-
|
|
20876
|
-
|
|
20877
|
-
|
|
20878
|
-
|
|
20886
|
+
if (!currentNode) return [3 /*break*/, 4];
|
|
20887
|
+
if ((!currentNode.textContent || currentNode.textContent.length === 0) || (currentNode.nodeType === Node.ELEMENT_NODE && currentNode.innerText.length === 0)) {
|
|
20888
|
+
previousSibling = currentNode.previousSibling;
|
|
20889
|
+
parentContainer.removeChild(currentNode);
|
|
20890
|
+
currentNode = previousSibling;
|
|
20891
|
+
}
|
|
20892
|
+
if (currentNode.nodeType === Node.ELEMENT_NODE &&
|
|
20893
|
+
this.parentHasStyle(currentNode.parentElement, currentNode)) {
|
|
20894
|
+
currentNodeFirstChild = currentNode;
|
|
20895
|
+
nextCurrentElement = currentNode.firstChild;
|
|
20896
|
+
while (currentNode.firstChild) {
|
|
20897
|
+
parentContainer.insertBefore(currentNode.firstChild, currentNodeFirstChild.nextSibling);
|
|
20898
|
+
currentNodeFirstChild = currentNodeFirstChild.nextSibling;
|
|
20899
|
+
}
|
|
20900
|
+
parentContainer.removeChild(currentNode);
|
|
20901
|
+
currentNode = nextCurrentElement;
|
|
20902
|
+
}
|
|
20879
20903
|
identicalElements = true;
|
|
20880
20904
|
while (identicalElements &&
|
|
20881
20905
|
currentNode.nextSibling &&
|
|
@@ -20886,8 +20910,7 @@
|
|
|
20886
20910
|
if (this.identicalInlineStyle(currentElement, nextElement) &&
|
|
20887
20911
|
currentElement.tagName.toLowerCase() === nextElement.tagName.toLowerCase() &&
|
|
20888
20912
|
this.identicalClassList(currentElement, nextElement) &&
|
|
20889
|
-
|
|
20890
|
-
!nextElement.hasAttributes()) {
|
|
20913
|
+
this.identicalAttributes(currentElement, nextElement)) {
|
|
20891
20914
|
currentElement.innerHTML += nextElement.innerHTML;
|
|
20892
20915
|
nextElement.remove();
|
|
20893
20916
|
this.modifiedContent = true;
|
|
@@ -20910,11 +20933,15 @@
|
|
|
20910
20933
|
this.modifiedContent = true;
|
|
20911
20934
|
}
|
|
20912
20935
|
currentNode.normalize();
|
|
20913
|
-
|
|
20914
|
-
|
|
20936
|
+
if (!(currentNode.childNodes.length > 0)) return [3 /*break*/, 3];
|
|
20937
|
+
return [4 /*yield*/, this.cleanupContainer(selection, currentNode, false)];
|
|
20938
|
+
case 2:
|
|
20939
|
+
_c.sent();
|
|
20940
|
+
_c.label = 3;
|
|
20941
|
+
case 3:
|
|
20915
20942
|
currentNode = currentNode.nextSibling;
|
|
20916
20943
|
return [3 /*break*/, 1];
|
|
20917
|
-
case
|
|
20944
|
+
case 4: return [2 /*return*/];
|
|
20918
20945
|
}
|
|
20919
20946
|
});
|
|
20920
20947
|
});
|
|
@@ -20934,6 +20961,17 @@
|
|
|
20934
20961
|
return (__spread(currentElement.classList).every(function (classList) { return nextElement.classList.contains(classList); }) &&
|
|
20935
20962
|
__spread(nextElement.classList).every(function (classList) { return currentElement.classList.contains(classList); }));
|
|
20936
20963
|
};
|
|
20964
|
+
InlineStyleTool.prototype.identicalAttributes = function (currentElement, nextElement) {
|
|
20965
|
+
var currentElementAttributes = currentElement.getAttributeNames();
|
|
20966
|
+
currentElementAttributes.forEach(function (attribute) {
|
|
20967
|
+
if (attribute !== 'style') {
|
|
20968
|
+
if (!nextElement.getAttribute(attribute) || nextElement.getAttribute(attribute) !== currentElement.getAttribute(attribute)) {
|
|
20969
|
+
return false;
|
|
20970
|
+
}
|
|
20971
|
+
}
|
|
20972
|
+
});
|
|
20973
|
+
return true;
|
|
20974
|
+
};
|
|
20937
20975
|
InlineStyleTool.prototype.identicalInlineStyle = function (currentElement, nextElement) {
|
|
20938
20976
|
var currentElementInlineStyle = this.getInlineStyle(currentElement);
|
|
20939
20977
|
var nextElementInlineStyle = this.getInlineStyle(nextElement);
|
|
@@ -20979,7 +21017,7 @@
|
|
|
20979
21017
|
InlineStyleTool.prototype.saveInlineSelection = function (container, firstTimeCall) {
|
|
20980
21018
|
if (firstTimeCall === void 0) { firstTimeCall = false; }
|
|
20981
21019
|
return __awaiter(this, void 0, void 0, function () {
|
|
20982
|
-
var nextNode, selection, range, currentFragment, currentElement;
|
|
21020
|
+
var nextNode, selection, isLTR, range, currentFragment, currentElement;
|
|
20983
21021
|
return __generator(this, function (_c) {
|
|
20984
21022
|
switch (_c.label) {
|
|
20985
21023
|
case 0:
|
|
@@ -21002,9 +21040,10 @@
|
|
|
21002
21040
|
case 1:
|
|
21003
21041
|
if (!(nextNode && (!this.foundAnchorNode || !this.foundFocusNode))) return [3 /*break*/, 4];
|
|
21004
21042
|
if (nextNode === this.selectedAnchorNode) {
|
|
21005
|
-
this.foundAnchorNode = true;
|
|
21006
|
-
this.foundAnchorOffset += this.anchorOffset;
|
|
21007
21043
|
selection = this.getSelection();
|
|
21044
|
+
isLTR = this.isAnchorBeforeFocus(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
|
|
21045
|
+
this.foundAnchorNode = true;
|
|
21046
|
+
this.foundAnchorOffset += isLTR ? this.anchorOffset : this.focusOffset;
|
|
21008
21047
|
range = this.getRangeObject(selection);
|
|
21009
21048
|
currentFragment = range.cloneContents();
|
|
21010
21049
|
currentElement = document.createElement('span');
|
|
@@ -22675,7 +22714,7 @@
|
|
|
22675
22714
|
if (!anchorNode) {
|
|
22676
22715
|
return [2 /*return*/];
|
|
22677
22716
|
}
|
|
22678
|
-
parentModifier = this.findParentModifier(
|
|
22717
|
+
parentModifier = this.findParentModifier();
|
|
22679
22718
|
try {
|
|
22680
22719
|
if (this.tag.toLowerCase() !== 'span') {
|
|
22681
22720
|
this.changeContainerTag(parentModifier, selection);
|
|
@@ -22812,22 +22851,6 @@
|
|
|
22812
22851
|
container.className += (container.className.length > 0 ? ' ' : '') + this.classToApply;
|
|
22813
22852
|
}
|
|
22814
22853
|
};
|
|
22815
|
-
ParagraphStyleTool.prototype.findParentModifier = function (element) {
|
|
22816
|
-
var currentElement = element;
|
|
22817
|
-
if (currentElement.tagName.toLowerCase() === 'div') {
|
|
22818
|
-
if (currentElement.classList.contains('ce-paragraph')) {
|
|
22819
|
-
return currentElement.children[0];
|
|
22820
|
-
}
|
|
22821
|
-
return currentElement.closest('.codex-editor__redactor').querySelector('.ce-paragraph').children[0];
|
|
22822
|
-
}
|
|
22823
|
-
while (this.modifiers.split(',').indexOf(currentElement.tagName.toLowerCase()) === -1) {
|
|
22824
|
-
if (currentElement.tagName.toLowerCase() === 'div') {
|
|
22825
|
-
return null;
|
|
22826
|
-
}
|
|
22827
|
-
currentElement = currentElement.parentElement;
|
|
22828
|
-
}
|
|
22829
|
-
return currentElement;
|
|
22830
|
-
};
|
|
22831
22854
|
return ParagraphStyleTool;
|
|
22832
22855
|
}(EditorJSTool));
|
|
22833
22856
|
var listApi = null;
|
|
@@ -23166,7 +23189,7 @@
|
|
|
23166
23189
|
if (!isBlockFocused) {
|
|
23167
23190
|
setBlockFocus(this.parentEditor);
|
|
23168
23191
|
}
|
|
23169
|
-
var parentModifier = this.findParentModifier(
|
|
23192
|
+
var parentModifier = this.findParentModifier();
|
|
23170
23193
|
if (!parentModifier) {
|
|
23171
23194
|
return false;
|
|
23172
23195
|
}
|
|
@@ -23477,7 +23500,7 @@
|
|
|
23477
23500
|
if (!isBlockFocused) {
|
|
23478
23501
|
setBlockFocus(this.parentEditor);
|
|
23479
23502
|
}
|
|
23480
|
-
var parentModifier = this.findParentModifier(
|
|
23503
|
+
var parentModifier = this.findParentModifier();
|
|
23481
23504
|
if (!parentModifier) {
|
|
23482
23505
|
return false;
|
|
23483
23506
|
}
|
|
@@ -23613,7 +23636,7 @@
|
|
|
23613
23636
|
if (!isBlockFocused) {
|
|
23614
23637
|
setBlockFocus(this.parentEditor);
|
|
23615
23638
|
}
|
|
23616
|
-
var parentModifier = this.findParentModifier(
|
|
23639
|
+
var parentModifier = this.findParentModifier();
|
|
23617
23640
|
if (!parentModifier) {
|
|
23618
23641
|
return false;
|
|
23619
23642
|
}
|
|
@@ -23701,7 +23724,7 @@
|
|
|
23701
23724
|
if (!isBlockFocused) {
|
|
23702
23725
|
setBlockFocus(this.parentEditor);
|
|
23703
23726
|
}
|
|
23704
|
-
var parentModifier = this.findParentModifier(
|
|
23727
|
+
var parentModifier = this.findParentModifier();
|
|
23705
23728
|
if (!parentModifier) {
|
|
23706
23729
|
return false;
|
|
23707
23730
|
}
|
|
@@ -23789,7 +23812,7 @@
|
|
|
23789
23812
|
if (!isBlockFocused) {
|
|
23790
23813
|
setBlockFocus(this.parentEditor);
|
|
23791
23814
|
}
|
|
23792
|
-
var parentModifier = this.findParentModifier(
|
|
23815
|
+
var parentModifier = this.findParentModifier();
|
|
23793
23816
|
if (!parentModifier) {
|
|
23794
23817
|
return false;
|
|
23795
23818
|
}
|
|
@@ -24427,23 +24450,6 @@
|
|
|
24427
24450
|
return true;
|
|
24428
24451
|
}
|
|
24429
24452
|
};
|
|
24430
|
-
InlineTextTool.prototype.findParentModifier = function (element) {
|
|
24431
|
-
var modifiers = 'h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote';
|
|
24432
|
-
var currentElement = element;
|
|
24433
|
-
if (currentElement.tagName.toLowerCase() === 'div') {
|
|
24434
|
-
if (currentElement.classList.contains('ce-paragraph')) {
|
|
24435
|
-
return currentElement.firstElementChild;
|
|
24436
|
-
}
|
|
24437
|
-
return currentElement.querySelector('.ce-paragraph').children[0];
|
|
24438
|
-
}
|
|
24439
|
-
while (modifiers.split(',').indexOf(currentElement.tagName.toLowerCase()) === -1) {
|
|
24440
|
-
if (currentElement.tagName.toLowerCase() === 'div') {
|
|
24441
|
-
return null;
|
|
24442
|
-
}
|
|
24443
|
-
currentElement = currentElement.parentElement;
|
|
24444
|
-
}
|
|
24445
|
-
return currentElement;
|
|
24446
|
-
};
|
|
24447
24453
|
return InlineTextTool;
|
|
24448
24454
|
}(InlineStyleTool));
|
|
24449
24455
|
|
|
@@ -25276,6 +25282,7 @@
|
|
|
25276
25282
|
this.timeoutHandle = null;
|
|
25277
25283
|
this.timeoutTextEditionHandle = null;
|
|
25278
25284
|
this.onChangeTimeoutHandle = null;
|
|
25285
|
+
this.editorInitialized = false;
|
|
25279
25286
|
this.wrapperTags = 'h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote';
|
|
25280
25287
|
}
|
|
25281
25288
|
EditorJsComponent.prototype.ngOnInit = function () {
|
|
@@ -25342,7 +25349,7 @@
|
|
|
25342
25349
|
clearTimeout(_this.onChangeTimeoutHandle);
|
|
25343
25350
|
_this.onChangeTimeoutHandle = setTimeout(function () {
|
|
25344
25351
|
_this.contentChanged(api, event);
|
|
25345
|
-
},
|
|
25352
|
+
}, 200);
|
|
25346
25353
|
},
|
|
25347
25354
|
i18n: this.getI18nDictionnary(),
|
|
25348
25355
|
});
|
|
@@ -25357,12 +25364,10 @@
|
|
|
25357
25364
|
_this.content = content;
|
|
25358
25365
|
_this.applyContent();
|
|
25359
25366
|
_this.checkSingleChild();
|
|
25360
|
-
|
|
25361
|
-
|
|
25362
|
-
|
|
25363
|
-
|
|
25364
|
-
});
|
|
25365
|
-
}, 0);
|
|
25367
|
+
var editorElement = document.getElementById('editorJs-' + _this.uuid);
|
|
25368
|
+
editorElement.addEventListener('focusin', function () {
|
|
25369
|
+
setlistApiEditor(_this.editor, editorElement);
|
|
25370
|
+
});
|
|
25366
25371
|
});
|
|
25367
25372
|
return [3 /*break*/, 4];
|
|
25368
25373
|
case 3:
|
|
@@ -25377,7 +25382,6 @@
|
|
|
25377
25382
|
EditorJsComponent.prototype.ngOnDestroy = function () {
|
|
25378
25383
|
var editorName = 'editorJs-' + this.uuid;
|
|
25379
25384
|
this.deleteSavedEditorContent(editorName);
|
|
25380
|
-
this.deleteSavedEditorContent(editorName);
|
|
25381
25385
|
this.editor.destroy();
|
|
25382
25386
|
};
|
|
25383
25387
|
EditorJsComponent.prototype.handleDefaultContentTranslation = function () {
|
|
@@ -25395,7 +25399,13 @@
|
|
|
25395
25399
|
.save()
|
|
25396
25400
|
.then(function () {
|
|
25397
25401
|
_this.content = _this.getEditorContent();
|
|
25398
|
-
|
|
25402
|
+
if (!_this.editorInitialized) {
|
|
25403
|
+
_this.handleSaveEditor(_this.content, _this.uuid);
|
|
25404
|
+
_this.editorInitialized = true;
|
|
25405
|
+
}
|
|
25406
|
+
else {
|
|
25407
|
+
_this.saveEditorContent(_this.content);
|
|
25408
|
+
}
|
|
25399
25409
|
_this.contentChange.emit(_this.content);
|
|
25400
25410
|
})
|
|
25401
25411
|
.catch(function (error) {
|
|
@@ -25538,12 +25548,12 @@
|
|
|
25538
25548
|
}
|
|
25539
25549
|
return null;
|
|
25540
25550
|
};
|
|
25541
|
-
EditorJsComponent.prototype.saveEditorContent = function (data
|
|
25551
|
+
EditorJsComponent.prototype.saveEditorContent = function (data) {
|
|
25542
25552
|
var _this = this;
|
|
25543
25553
|
if (!isTextEditionTool) {
|
|
25544
25554
|
clearTimeout(this.timeoutHandle);
|
|
25545
25555
|
this.timeoutHandle = setTimeout(function () {
|
|
25546
|
-
_this.handleSaveEditor(data, uuid);
|
|
25556
|
+
_this.handleSaveEditor(data, _this.uuid);
|
|
25547
25557
|
}, 2000);
|
|
25548
25558
|
}
|
|
25549
25559
|
else {
|
|
@@ -25559,6 +25569,10 @@
|
|
|
25559
25569
|
var savedDataIndex = this.getSavedEditorContent(editorName + '-index')
|
|
25560
25570
|
? parseInt(this.getSavedEditorContent(editorName + '-index'))
|
|
25561
25571
|
: -1;
|
|
25572
|
+
if (!this.editorInitialized) {
|
|
25573
|
+
savedData = null;
|
|
25574
|
+
savedDataIndex = -1;
|
|
25575
|
+
}
|
|
25562
25576
|
var parsedSavedData = [];
|
|
25563
25577
|
if (savedData) {
|
|
25564
25578
|
parsedSavedData = JSON.parse(savedData);
|
|
@@ -25580,6 +25594,7 @@
|
|
|
25580
25594
|
};
|
|
25581
25595
|
EditorJsComponent.prototype.deleteSavedEditorContent = function (name) {
|
|
25582
25596
|
localStorage.removeItem(name);
|
|
25597
|
+
localStorage.removeItem(name + '-index');
|
|
25583
25598
|
};
|
|
25584
25599
|
return EditorJsComponent;
|
|
25585
25600
|
}());
|