@wizishop/wizi-block 4.2.31-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.
@@ -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, _b;
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,21 +22266,17 @@ class TextEditionTool extends ParagraphStyleTool {
22256
22266
  modal.appendChild(editorContainer);
22257
22267
  modal.appendChild(buttonContainer);
22258
22268
  container.appendChild(modal);
22259
- document.querySelector('body').appendChild(container);
22260
- setTimeout(() => {
22261
- console.log('monacoeditor init');
22262
- console.log(modal);
22263
- var monacoEditor = editor.create(editorContainer, {
22264
- value: content,
22265
- language: 'html',
22266
- ariaContainerElement: modal
22267
- });
22268
- saveButton.addEventListener('click', () => {
22269
- let content = monacoEditor.getValue();
22270
- saveCodeEditModal(content);
22271
- }, true);
22272
- buttonContainer.appendChild(saveButton);
22273
- }, 200);
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,
22277
+ });
22278
+ saveButton.addEventListener('click', () => saveCodeEditModal(view.state.doc.toString()), true);
22279
+ buttonContainer.appendChild(saveButton);
22274
22280
  }
22275
22281
  getSavedEditorContent(name) {
22276
22282
  return localStorage.getItem(name);