@wizishop/wizi-block 4.2.29-beta → 4.2.32-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 +27 -19
- 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/tools/inline/tool-type/inline-style-tool.component.js +13 -6
- package/esm2015/lib/shared/components/editorjs/tools/paragraph/tool-type/text-edition.component.js +13 -11
- package/fesm2015/wizishop-wizi-block.js +24 -14
- package/fesm2015/wizishop-wizi-block.js.map +1 -1
- package/package.json +5 -1
|
@@ -23,6 +23,9 @@ import { NgScrollbarModule } from 'ngx-scrollbar';
|
|
|
23
23
|
import { __awaiter } from 'tslib';
|
|
24
24
|
import EditorJS from '@editorjs/editorjs';
|
|
25
25
|
import iro from '@jaames/iro';
|
|
26
|
+
import { basicSetup, EditorView } from 'codemirror';
|
|
27
|
+
import { EditorState } from '@codemirror/state';
|
|
28
|
+
import { html } from '@codemirror/lang-html';
|
|
26
29
|
import { MonacoEditorModule } from 'ngx-monaco-editor';
|
|
27
30
|
import { tileLayer, latLng, marker, icon } from 'leaflet';
|
|
28
31
|
import places from 'places.js';
|
|
@@ -18728,6 +18731,8 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
18728
18731
|
: anchorNode.parentElement;
|
|
18729
18732
|
const sameSelection = container && container.innerText === selection.toString();
|
|
18730
18733
|
yield this.saveInlineSelection(container, true);
|
|
18734
|
+
console.log('here');
|
|
18735
|
+
console.log(this.hasStyle(container));
|
|
18731
18736
|
try {
|
|
18732
18737
|
// Link delete exception
|
|
18733
18738
|
if (this.linkDeletion) {
|
|
@@ -18738,9 +18743,11 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
18738
18743
|
!this.isContainer(this.textContainers, container) &&
|
|
18739
18744
|
this.hasStyle(container) &&
|
|
18740
18745
|
selection.toString() === this.hasStyle(container).innerText) {
|
|
18746
|
+
console.log('update');
|
|
18741
18747
|
yield this.updateSelection(selection, this.hasStyle(container), action, this.textContainers);
|
|
18742
18748
|
}
|
|
18743
18749
|
else {
|
|
18750
|
+
console.log('replace');
|
|
18744
18751
|
yield this.replaceSelection(this.getMostDescendantChild(container), action, selection, this.textContainers);
|
|
18745
18752
|
}
|
|
18746
18753
|
}
|
|
@@ -18804,6 +18811,7 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
18804
18811
|
parentContainer === offsetParentContainer &&
|
|
18805
18812
|
((parentContainer.children.length > 0 && parentContainer.innerText !== parentContainer.children[0].textContent) ||
|
|
18806
18813
|
parentContainer.innerText !== selection.toString())) {
|
|
18814
|
+
console.log('if');
|
|
18807
18815
|
const range = this.getRangeObject(selection);
|
|
18808
18816
|
const currentFragment = range.extractContents();
|
|
18809
18817
|
const currentElement = document.createElement('span');
|
|
@@ -18826,6 +18834,8 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
18826
18834
|
let currentParentElement = container;
|
|
18827
18835
|
if (parentContainer.contains(currentParentElement)) {
|
|
18828
18836
|
while (currentParentElement !== parentContainer) {
|
|
18837
|
+
console.warn('currentParentElement');
|
|
18838
|
+
console.log(currentParentElement);
|
|
18829
18839
|
let tmpElement = document.createElement(currentParentElement.tagName);
|
|
18830
18840
|
tmpElement = this.setInlineStyle(currentParentElement, tmpElement);
|
|
18831
18841
|
tmpElement.appendChild(currentElementToAppend);
|
|
@@ -18845,9 +18855,13 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
18845
18855
|
newElement.appendChild(preFragment);
|
|
18846
18856
|
parentContainer.parentElement.insertBefore(currentElementToAppend, parentContainer);
|
|
18847
18857
|
parentContainer.parentElement.insertBefore(newElement, currentElementToAppend);
|
|
18858
|
+
if (!parentContainer.textContent || parentContainer.textContent.length === 0) {
|
|
18859
|
+
parentContainer.parentElement.removeChild(parentContainer);
|
|
18860
|
+
}
|
|
18848
18861
|
selection.selectAllChildren(currentElementToAppend);
|
|
18849
18862
|
}
|
|
18850
18863
|
else {
|
|
18864
|
+
console.log('else');
|
|
18851
18865
|
const range = this.getRangeObject(selection);
|
|
18852
18866
|
const fragment = range.extractContents();
|
|
18853
18867
|
let fragmentElement = document.createElement('div');
|
|
@@ -19025,7 +19039,7 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
19025
19039
|
});
|
|
19026
19040
|
}
|
|
19027
19041
|
cleanupContainer(selection, container, firstTimeCall) {
|
|
19028
|
-
var _a
|
|
19042
|
+
var _a;
|
|
19029
19043
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19030
19044
|
let parentContainer;
|
|
19031
19045
|
let parentFound = false;
|
|
@@ -19050,10 +19064,6 @@ class InlineStyleTool extends EditorJSTool {
|
|
|
19050
19064
|
const children = Array.from(parentContainer.childNodes);
|
|
19051
19065
|
if ((children === null || children === void 0 ? void 0 : children.length) > 0) {
|
|
19052
19066
|
for (var currentNode = children[0]; currentNode; currentNode = currentNode.nextSibling) {
|
|
19053
|
-
console.log('currentNode');
|
|
19054
|
-
console.log(currentNode);
|
|
19055
|
-
console.log(currentNode.textContent);
|
|
19056
|
-
console.log((_b = currentNode.textContent) === null || _b === void 0 ? void 0 : _b.length);
|
|
19057
19067
|
if (!currentNode.textContent || currentNode.textContent.length === 0) {
|
|
19058
19068
|
parentContainer.removeChild(currentNode);
|
|
19059
19069
|
}
|
|
@@ -22256,16 +22266,16 @@ class TextEditionTool extends ParagraphStyleTool {
|
|
|
22256
22266
|
modal.appendChild(editorContainer);
|
|
22257
22267
|
modal.appendChild(buttonContainer);
|
|
22258
22268
|
container.appendChild(modal);
|
|
22259
|
-
document.
|
|
22260
|
-
|
|
22261
|
-
|
|
22262
|
-
|
|
22263
|
-
|
|
22269
|
+
document.body.appendChild(container);
|
|
22270
|
+
let state = EditorState.create({
|
|
22271
|
+
doc: content,
|
|
22272
|
+
extensions: [basicSetup, html()],
|
|
22273
|
+
});
|
|
22274
|
+
let view = new EditorView({
|
|
22275
|
+
state: state,
|
|
22276
|
+
parent: editorContainer,
|
|
22264
22277
|
});
|
|
22265
|
-
saveButton.addEventListener('click', () =>
|
|
22266
|
-
let content = monacoEditor.getValue();
|
|
22267
|
-
saveCodeEditModal(content);
|
|
22268
|
-
}, true);
|
|
22278
|
+
saveButton.addEventListener('click', () => saveCodeEditModal(view.state.doc.toString()), true);
|
|
22269
22279
|
buttonContainer.appendChild(saveButton);
|
|
22270
22280
|
}
|
|
22271
22281
|
getSavedEditorContent(name) {
|