@wizishop/wizi-block 4.2.23-beta → 4.2.26-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.
Files changed (21) hide show
  1. package/assets/i18n/en.json +1 -1
  2. package/assets/i18n/fr.json +1 -1
  3. package/bundles/wizishop-wizi-block.umd.js +97 -32
  4. package/bundles/wizishop-wizi-block.umd.js.map +1 -1
  5. package/bundles/wizishop-wizi-block.umd.min.js +1 -1
  6. package/bundles/wizishop-wizi-block.umd.min.js.map +1 -1
  7. package/esm2015/lib/shared/components/editorjs/tools/inline/link-tool.component.js +52 -11
  8. package/esm2015/lib/shared/components/editorjs/tools/inline/text-background-color-tool.component.js +2 -1
  9. package/esm2015/lib/shared/components/editorjs/tools/inline/tool-type/inline-style-tool.component.js +5 -2
  10. package/esm2015/lib/shared/components/editorjs/tools/paragraph/tool-type/paragraph-style-tool.component.js +19 -5
  11. package/esm2015/lib/shared/components/editorjs/tools/paragraph/tool-type/text-edition.component.js +13 -14
  12. package/esm2015/lib/shared/components/editorjs/tools/utils/editorjs-tool.component.js +6 -1
  13. package/esm2015/lib/shared/components/editorjs/tools/utils/i18n/en-i18n.component.js +3 -3
  14. package/esm2015/lib/shared/components/editorjs/tools/utils/i18n/fr-i18n.component.js +3 -3
  15. package/fesm2015/wizishop-wizi-block.js +95 -32
  16. package/fesm2015/wizishop-wizi-block.js.map +1 -1
  17. package/lib/shared/components/editorjs/tools/inline/link-tool.component.d.ts +1 -0
  18. package/lib/shared/components/editorjs/tools/inline/tool-type/inline-style-tool.component.d.ts +1 -0
  19. package/lib/shared/components/editorjs/tools/utils/editorjs-tool.component.d.ts +1 -0
  20. package/package.json +4 -2
  21. package/wizi-block.scss +723 -689
@@ -20323,6 +20323,7 @@
20323
20323
  };
20324
20324
  EditorJSTool.prototype.resetUserSelection = function () {
20325
20325
  var _a;
20326
+ console.log('reset here');
20326
20327
  if (this.selectedAnchorNode.nodeType === Node.ELEMENT_NODE && this.selectedAnchorNode.children) {
20327
20328
  while (this.selectedAnchorNode.children &&
20328
20329
  this.selectedAnchorNode.innerText === ((_a = this.selectedAnchorNode.children[0]) === null || _a === void 0 ? void 0 : _a.innerText) &&
@@ -20346,6 +20347,10 @@
20346
20347
  }
20347
20348
  document.getSelection().setBaseAndExtent(this.selectedAnchorNode, this.anchorOffset, this.selectedFocusNode, this.focusOffset);
20348
20349
  };
20350
+ EditorJSTool.prototype.collapseSelection = function () {
20351
+ var selection = this.getSelection();
20352
+ document.getSelection().setBaseAndExtent(selection.anchorNode, 0, selection.anchorNode, 0);
20353
+ };
20349
20354
  EditorJSTool.prototype.findParentEditor = function () {
20350
20355
  var selection = this.currentSelection ? this.currentSelection : this.getSelection();
20351
20356
  return selection.anchorNode.parentElement.closest('.editorJs');
@@ -20406,6 +20411,7 @@
20406
20411
  _this.foundFocusNode = false;
20407
20412
  _this.tmpOffset = 0;
20408
20413
  _this.modifiedContent = false;
20414
+ _this.linkDeletion = false;
20409
20415
  _this.modifies = {
20410
20416
  tag: false,
20411
20417
  style: false,
@@ -20438,7 +20444,7 @@
20438
20444
  return [4 /*yield*/, this.saveInlineSelection(container, true)];
20439
20445
  case 1:
20440
20446
  _d.sent();
20441
- if (!(this.modifies.tag && this.tag.toLowerCase() === 'a' && !this.attributesToApply)) return [3 /*break*/, 3];
20447
+ if (!this.linkDeletion) return [3 /*break*/, 3];
20442
20448
  return [4 /*yield*/, this.replaceLink(selection, this.hasStyle(container))];
20443
20449
  case 2:
20444
20450
  _d.sent();
@@ -20617,6 +20623,8 @@
20617
20623
  return __awaiter(this, void 0, void 0, function () {
20618
20624
  var newElement;
20619
20625
  return __generator(this, function (_d) {
20626
+ console.log('container');
20627
+ console.log(container);
20620
20628
  newElement = document.createElement('span');
20621
20629
  newElement.innerHTML = container.innerHTML;
20622
20630
  container.parentElement.replaceChild(newElement, container);
@@ -22501,6 +22509,8 @@
22501
22509
  if (inputToFocus) {
22502
22510
  inputToFocus.focus();
22503
22511
  }
22512
+ //this.hideActions();
22513
+ this.collapseSelection();
22504
22514
  return [2 /*return*/];
22505
22515
  }
22506
22516
  });
@@ -22592,6 +22602,7 @@
22592
22602
  if (!selection) {
22593
22603
  return [2 /*return*/];
22594
22604
  }
22605
+ this.saveUserSelection();
22595
22606
  anchorNode = selection.anchorNode;
22596
22607
  if (!this.parentEditor) {
22597
22608
  this.parentEditor = this.findParentEditor();
@@ -22606,8 +22617,7 @@
22606
22617
  if ((this.classToApply && this.classToApply.length > 0) || (this.classes && this.classes.length > 0)) {
22607
22618
  this.changeCurrentClass(parentModifier);
22608
22619
  }
22609
- this.saveUserSelection();
22610
- this.resetUserSelection();
22620
+ this.collapseSelection();
22611
22621
  return [2 /*return*/];
22612
22622
  });
22613
22623
  });
@@ -22736,9 +22746,9 @@
22736
22746
  var currentElement = element;
22737
22747
  if (currentElement.tagName.toLowerCase() === 'div') {
22738
22748
  if (currentElement.classList.contains('ce-paragraph')) {
22739
- return currentElement;
22749
+ return currentElement.children[0];
22740
22750
  }
22741
- return currentElement.parentElement.querySelector('.ce-paragraph').children[0];
22751
+ return currentElement.closest('.codex-editor__redactor').querySelector('.ce-paragraph').children[0];
22742
22752
  }
22743
22753
  while (this.modifiers.split(',').indexOf(currentElement.tagName.toLowerCase()) === -1) {
22744
22754
  if (currentElement.tagName.toLowerCase() === 'div') {
@@ -22767,6 +22777,20 @@
22767
22777
  currentParagraph.removeEventListener('keydown', onEditList, true);
22768
22778
  document.getSelection().setBaseAndExtent(currentParagraph.querySelector('p'), 0, currentParagraph.querySelector('p'), 0);
22769
22779
  }
22780
+ else {
22781
+ var selection = document.getSelection();
22782
+ if (selection.anchorOffset === 0) {
22783
+ var newParagraph = document.createElement('p');
22784
+ var currentParagraph = listEditor.querySelectorAll('.ce-paragraph')[listApi.blocks.getCurrentBlockIndex()];
22785
+ newParagraph.innerHTML = currentParagraph.querySelector('li').innerHTML;
22786
+ currentParagraph.innerHTML = '';
22787
+ currentParagraph.appendChild(newParagraph);
22788
+ currentParagraph.removeEventListener('keydown', onEditList, true);
22789
+ document
22790
+ .getSelection()
22791
+ .setBaseAndExtent(currentParagraph.querySelector('p'), 0, currentParagraph.querySelector('p'), 0);
22792
+ }
22793
+ }
22770
22794
  }
22771
22795
  else {
22772
22796
  event.preventDefault();
@@ -23165,7 +23189,7 @@
23165
23189
  placeholder: 'https://www.maboutique.fr or /monlien/',
23166
23190
  external: 'Externe ?',
23167
23191
  obfuscated: 'Lien Obfusqué ?',
23168
- info: 'L\'obfuscation de liens est une technique SEO avancée qui consiste à cacher un lien aux robots des moteurs de recherche, tout en le laissant accessible pour les internautes. <a href="https://www.wizishop.fr/blog/obfuscation-lien">Découvrir l\'article complet.</a>',
23192
+ info: 'L\'obfuscation de liens est une technique SEO avancée qui consiste à cacher un lien aux robots des moteurs de recherche, tout en le laissant accessible pour les internautes. <a href="https://www.wizishop.fr/blog/obfuscation-lien" target="_blank">Découvrir l\'article complet.</a>',
23169
23193
  },
23170
23194
  textBackgroundColor: {
23171
23195
  customColor: 'Sélectionner une couleur personnalisée :',
@@ -23184,7 +23208,7 @@
23184
23208
  Small: 'Petit',
23185
23209
  Normal: 'Normal',
23186
23210
  Large: 'Grand',
23187
- Huge: 'Immense',
23211
+ Huge: 'Très grand',
23188
23212
  },
23189
23213
  codeEdit: {
23190
23214
  Cancel: 'Annuler',
@@ -23249,7 +23273,7 @@
23249
23273
  placeholder: 'https://www.myshop.fr or /mylink/',
23250
23274
  external: 'External?',
23251
23275
  obfuscated: 'Obfuscated link?',
23252
- info: 'Link obfuscation is an advanced SEO technique that consists in hiding a link from search engine robots, while leaving it available for users. <a href="https://wizishop.com/blog/url-obfuscation">Read more</a>',
23276
+ info: 'Link obfuscation is an advanced SEO technique that consists in hiding a link from search engine robots, while leaving it available for users. <a href="https://wizishop.com/blog/url-obfuscation" target="_blank">Read more</a>',
23253
23277
  },
23254
23278
  textBackgroundColor: {
23255
23279
  customColor: 'Select a custom color :',
@@ -23268,7 +23292,7 @@
23268
23292
  Small: 'Small',
23269
23293
  Normal: 'Normal',
23270
23294
  Large: 'Large',
23271
- Huge: 'Huge',
23295
+ Huge: 'Very large',
23272
23296
  },
23273
23297
  codeEdit: {
23274
23298
  Cancel: 'Cancel',
@@ -23722,6 +23746,7 @@
23722
23746
  };
23723
23747
  _this.tag = 'SPAN';
23724
23748
  _this.hasSeparatorBefore = true;
23749
+ _this.linkDeletion = false;
23725
23750
  _this.modifies = {
23726
23751
  tag: false,
23727
23752
  style: false,
@@ -23739,7 +23764,7 @@
23739
23764
  addButtonClass: 'ce-inline-actions--link__add',
23740
23765
  deleteButtonClass: 'ce-inline-actions--link__delete',
23741
23766
  };
23742
- _this.attributeName = 'data-htap,href';
23767
+ _this.attributeName = 'data-htap,href,data-knalb';
23743
23768
  _this.attributesToApply = [];
23744
23769
  _this.isLinkDropdownOpen = false;
23745
23770
  _this.api = api;
@@ -23834,12 +23859,6 @@
23834
23859
  targetCheckbox = this.parentEditor.querySelector('#' + this.linkCss['targetCheckboxId'] + uuid);
23835
23860
  obfuscationCheckbox = this.parentEditor.querySelector('#' + this.linkCss['obfuscationCheckboxId'] + uuid);
23836
23861
  linkInput = this.parentEditor.querySelector('#' + this.linkCss['linkInputId'] + uuid);
23837
- if (targetCheckbox.checked) {
23838
- this.attributesToApply.push({
23839
- name: 'target',
23840
- value: '_blank',
23841
- });
23842
- }
23843
23862
  if (obfuscationCheckbox.checked) {
23844
23863
  this.tag = 'SPAN';
23845
23864
  this.modifies.tag = false;
@@ -23847,6 +23866,12 @@
23847
23866
  name: 'data-htap',
23848
23867
  value: btoa(linkInput.value),
23849
23868
  });
23869
+ if (targetCheckbox.checked) {
23870
+ this.attributesToApply.push({
23871
+ name: 'data-knalb',
23872
+ value: 'true',
23873
+ });
23874
+ }
23850
23875
  }
23851
23876
  else {
23852
23877
  this.tag = 'A';
@@ -23855,6 +23880,12 @@
23855
23880
  name: 'href',
23856
23881
  value: linkInput.value,
23857
23882
  });
23883
+ if (targetCheckbox.checked) {
23884
+ this.attributesToApply.push({
23885
+ name: 'target',
23886
+ value: '_blank',
23887
+ });
23888
+ }
23858
23889
  }
23859
23890
  this.resetUserSelection();
23860
23891
  return [4 /*yield*/, this.surround(null, true)];
@@ -23869,21 +23900,53 @@
23869
23900
  };
23870
23901
  LinkTool.prototype.deleteLink = function () {
23871
23902
  return __awaiter(this, void 0, void 0, function () {
23903
+ var uuid, targetCheckbox, obfuscationCheckbox, linkInput;
23872
23904
  return __generator(this, function (_a) {
23873
23905
  switch (_a.label) {
23874
23906
  case 0:
23875
23907
  if (!this.parentEditor) {
23876
23908
  this.parentEditor = this.findParentEditor();
23877
23909
  }
23878
- this.tag = 'A';
23879
- this.attributesToApply = null;
23880
- this.modifies.tag = true;
23910
+ uuid = this.parentEditor.getAttribute('id').replace('editorJs-', '');
23911
+ targetCheckbox = this.parentEditor.querySelector('#' + this.linkCss['targetCheckboxId'] + uuid);
23912
+ obfuscationCheckbox = this.parentEditor.querySelector('#' + this.linkCss['obfuscationCheckboxId'] + uuid);
23913
+ linkInput = this.parentEditor.querySelector('#' + this.linkCss['linkInputId'] + uuid);
23914
+ if (obfuscationCheckbox.checked) {
23915
+ this.tag = 'SPAN';
23916
+ this.modifies.tag = false;
23917
+ this.attributesToApply.push({
23918
+ name: 'data-htap',
23919
+ value: btoa(linkInput.value),
23920
+ });
23921
+ if (targetCheckbox.checked) {
23922
+ this.attributesToApply.push({
23923
+ name: 'data-knalb',
23924
+ value: 'true',
23925
+ });
23926
+ }
23927
+ }
23928
+ else {
23929
+ this.tag = 'A';
23930
+ this.modifies.tag = true;
23931
+ this.attributesToApply.push({
23932
+ name: 'href',
23933
+ value: linkInput.value,
23934
+ });
23935
+ if (targetCheckbox.checked) {
23936
+ this.attributesToApply.push({
23937
+ name: 'target',
23938
+ value: '_blank',
23939
+ });
23940
+ }
23941
+ }
23942
+ this.linkDeletion = true;
23881
23943
  this.resetUserSelection();
23882
23944
  return [4 /*yield*/, this.surround(null, true)];
23883
23945
  case 1:
23884
23946
  _a.sent();
23885
23947
  this.checkState(this.currentSelection);
23886
23948
  this.openLinkDropdown();
23949
+ this.linkDeletion = false;
23887
23950
  return [2 /*return*/];
23888
23951
  }
23889
23952
  });
@@ -23967,6 +24030,9 @@
23967
24030
  }
23968
24031
  }
23969
24032
  else {
24033
+ linkInput.value = '';
24034
+ targetCheckbox.checked = false;
24035
+ obfuscationCheckbox.checked = false;
23970
24036
  if (!deleteButton.classList.contains('hidden')) {
23971
24037
  deleteButton.classList.add('hidden');
23972
24038
  }
@@ -24522,8 +24588,7 @@
24522
24588
  };
24523
24589
  TextEditionTool.prototype.editHTML = function () {
24524
24590
  var content = this.getEditorContent();
24525
- var modal = this.createHTMLEditModal(content);
24526
- document.querySelector('body').appendChild(modal);
24591
+ this.createHTMLEditModal(content);
24527
24592
  };
24528
24593
  TextEditionTool.prototype.createHTMLEditModal = function (content) {
24529
24594
  var container = document.createElement('div');
@@ -24532,11 +24597,6 @@
24532
24597
  modal.classList.add(this.modalClass);
24533
24598
  var editorContainer = document.createElement('div');
24534
24599
  editorContainer.classList.add(this.editorClass);
24535
- var monacoEditor = monaco.editor.create(editorContainer, {
24536
- value: content,
24537
- language: 'html',
24538
- automaticLayout: true,
24539
- });
24540
24600
  codeEditEditor = this.findParentEditor();
24541
24601
  codeEditApi = this.api;
24542
24602
  var buttonContainer = document.createElement('div');
@@ -24545,17 +24605,22 @@
24545
24605
  cancelButton.innerText = editorJSI18nDictionnary.messages.tools.codeEdit['Cancel'];
24546
24606
  saveButton.innerText = editorJSI18nDictionnary.messages.tools.codeEdit['Save'];
24547
24607
  cancelButton.addEventListener('click', closeCodeEditModal, true);
24548
- saveButton.addEventListener('click', function () {
24549
- var content = monacoEditor.getValue();
24550
- saveCodeEditModal(content);
24551
- }, true);
24552
24608
  buttonContainer.appendChild(cancelButton);
24553
- buttonContainer.appendChild(saveButton);
24554
24609
  buttonContainer.classList.add(this.buttonClass);
24555
24610
  modal.appendChild(editorContainer);
24556
24611
  modal.appendChild(buttonContainer);
24557
24612
  container.appendChild(modal);
24558
- return container;
24613
+ document.querySelector('body').appendChild(container);
24614
+ var monacoEditor = monaco.editor.create(editorContainer, {
24615
+ value: content,
24616
+ language: 'html',
24617
+ });
24618
+ saveButton.addEventListener('click', function () {
24619
+ console.log("here");
24620
+ var content = monacoEditor.getValue();
24621
+ saveCodeEditModal(content);
24622
+ }, true);
24623
+ buttonContainer.appendChild(saveButton);
24559
24624
  };
24560
24625
  TextEditionTool.prototype.getSavedEditorContent = function (name) {
24561
24626
  return localStorage.getItem(name);