jodit 4.2.33 → 4.2.35

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 (60) hide show
  1. package/CHANGELOG.md +17 -5
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +29 -19
  5. package/es2015/jodit.min.js +2 -2
  6. package/es2015/plugins/debug/debug.js +1 -1
  7. package/es2015/plugins/debug/debug.min.js +1 -1
  8. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  11. package/es2018/jodit.css +1 -1
  12. package/es2018/jodit.fat.min.js +2 -2
  13. package/es2018/jodit.js +29 -19
  14. package/es2018/jodit.min.js +2 -2
  15. package/es2018/plugins/debug/debug.js +1 -1
  16. package/es2018/plugins/debug/debug.min.js +1 -1
  17. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  18. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  20. package/es2021/jodit.css +1 -1
  21. package/es2021/jodit.fat.min.js +2 -2
  22. package/es2021/jodit.js +29 -19
  23. package/es2021/jodit.min.js +2 -2
  24. package/es2021/plugins/debug/debug.js +1 -1
  25. package/es2021/plugins/debug/debug.min.js +1 -1
  26. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  27. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  28. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  29. package/es2021.en/jodit.css +1 -1
  30. package/es2021.en/jodit.fat.min.js +2 -2
  31. package/es2021.en/jodit.js +29 -19
  32. package/es2021.en/jodit.min.js +2 -2
  33. package/es2021.en/plugins/debug/debug.js +1 -1
  34. package/es2021.en/plugins/debug/debug.min.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  36. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  37. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  38. package/es5/164.fat.min.js +1 -1
  39. package/es5/164.min.js +1 -1
  40. package/es5/5.fat.min.js +1 -1
  41. package/es5/5.min.js +1 -1
  42. package/es5/jodit.css +2 -2
  43. package/es5/jodit.fat.min.js +2 -2
  44. package/es5/jodit.js +29 -19
  45. package/es5/jodit.min.css +2 -2
  46. package/es5/jodit.min.js +2 -2
  47. package/es5/plugins/debug/debug.js +1 -1
  48. package/es5/plugins/debug/debug.min.js +1 -1
  49. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  50. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  51. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  52. package/esm/core/constants.js +1 -1
  53. package/esm/core/selection/style/api/list/toggle-ordered-list.js +3 -1
  54. package/esm/core/selection/style/api/list/wrap-list.d.ts +1 -1
  55. package/esm/modules/history/snapshot.d.ts +1 -1
  56. package/esm/modules/history/snapshot.js +10 -8
  57. package/esm/plugins/link/link.js +10 -4
  58. package/package.json +1 -1
  59. package/types/core/selection/style/api/list/wrap-list.d.ts +1 -1
  60. package/types/modules/history/snapshot.d.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.2.33
4
+ * Version: v4.2.35
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1736,7 +1736,7 @@ __webpack_require__.r(__webpack_exports__);
1736
1736
  * Released under MIT see LICENSE.txt in the project root for license information.
1737
1737
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1738
1738
  */
1739
- const APP_VERSION = "4.2.33";
1739
+ const APP_VERSION = "4.2.35";
1740
1740
  // prettier-ignore
1741
1741
  const ES = "es2021";
1742
1742
  const IS_ES_MODERN = true;
@@ -11810,7 +11810,9 @@ function unwrapList(mode, list, li, jodit, cs) {
11810
11810
  (0,jodit_core_selection_style_api_extract__WEBPACK_IMPORTED_MODULE_2__/* .extractSelectedPart */ .y)(list, li, jodit);
11811
11811
  void 0;
11812
11812
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.unwrap(li.parentElement);
11813
- return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.replace(li, jodit.o.enter, jodit.createInside);
11813
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.replace(li, jodit.o.enter.toLowerCase() !== 'br'
11814
+ ? jodit.o.enter
11815
+ : jodit.createInside.fragment(), jodit.createInside);
11814
11816
  }
11815
11817
 
11816
11818
 
@@ -20833,7 +20835,7 @@ class History extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .ViewC
20833
20835
  /* harmony export */ });
20834
20836
  /* harmony import */ var jodit_core_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77753);
20835
20837
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17352);
20836
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(71842);
20838
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55186);
20837
20839
  /*!
20838
20840
  * Jodit Editor (https://xdsoft.net/jodit/)
20839
20841
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -20876,7 +20878,7 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20876
20878
  for (let j = 0; j < elms.length; j += 1) {
20877
20879
  if (previous &&
20878
20880
  !this.isIgnoredNode(elms[j]) &&
20879
- !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(previous) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elms[j]))) {
20881
+ !(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(previous) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elms[j]))) {
20880
20882
  count += 1;
20881
20883
  }
20882
20884
  if (elms[j] === elm) {
@@ -20890,9 +20892,9 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20890
20892
  * Calc normal offset in joined text nodes
20891
20893
  */
20892
20894
  static strokeOffset(elm, offset) {
20893
- while (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
20895
+ while (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
20894
20896
  elm = elm.previousSibling;
20895
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
20897
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
20896
20898
  offset += elm.nodeValue.length;
20897
20899
  }
20898
20900
  }
@@ -20903,7 +20905,7 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20903
20905
  */
20904
20906
  calcHierarchyLadder(elm) {
20905
20907
  const counts = [];
20906
- if (!elm || !elm.parentNode || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
20908
+ if (!elm || !elm.parentNode || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
20907
20909
  return [];
20908
20910
  }
20909
20911
  while (elm && elm !== this.j.editor) {
@@ -20955,10 +20957,12 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20955
20957
  endOffset: 0
20956
20958
  }
20957
20959
  };
20958
- snapshot.html = this.removeJoditSelection(this.j.editor);
20960
+ snapshot.html = this.__getCleanedEditorValue(this.j.editor);
20959
20961
  const sel = this.j.s.sel;
20960
20962
  if (sel && sel.rangeCount) {
20961
- const range = sel.getRangeAt(0), startContainer = this.calcHierarchyLadder(range.startContainer), endContainer = this.calcHierarchyLadder(range.endContainer);
20963
+ const range = sel.getRangeAt(0);
20964
+ const startContainer = this.calcHierarchyLadder(range.startContainer);
20965
+ const endContainer = this.calcHierarchyLadder(range.endContainer);
20962
20966
  let startOffset = Snapshot.strokeOffset(range.startContainer, range.startOffset), endOffset = Snapshot.strokeOffset(range.endContainer, range.endOffset);
20963
20967
  if (!startContainer.length &&
20964
20968
  range.startContainer !== this.j.editor) {
@@ -20985,8 +20989,8 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20985
20989
  restore(snapshot) {
20986
20990
  this.transaction(() => {
20987
20991
  const scroll = this.storeScrollState();
20988
- const value = this.j.getNativeEditorValue();
20989
- if (value !== snapshot.html) {
20992
+ const html = this.__getCleanedEditorValue(this.j.editor);
20993
+ if (html !== snapshot.html) {
20990
20994
  this.j.value = snapshot.html;
20991
20995
  }
20992
20996
  this.restoreOnlySelection(snapshot);
@@ -21030,11 +21034,11 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
21030
21034
  super.destruct();
21031
21035
  }
21032
21036
  static isIgnoredNode(node) {
21033
- return (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(node) && !node.nodeValue) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isTemporary(node);
21037
+ return (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(node) && !node.nodeValue) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isTemporary(node);
21034
21038
  }
21035
- removeJoditSelection(node) {
21039
+ __getCleanedEditorValue(node) {
21036
21040
  const clone = node.cloneNode(true);
21037
- clone.querySelectorAll(`[${jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.TEMP_ATTR}]`).forEach(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
21041
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.temporaryList(clone).forEach(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
21038
21042
  return clone.innerHTML;
21039
21043
  }
21040
21044
  }
@@ -34010,13 +34014,19 @@ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .
34010
34014
  __generateForm(current, close) {
34011
34015
  const { jodit } = this;
34012
34016
  const i18n = jodit.i18n.bind(jodit), { openInNewTabCheckbox, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
34013
- const html = formTemplate(jodit), form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
34017
+ const html = formTemplate(jodit);
34018
+ const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
34014
34019
  ? jodit.c.fromHTML(html, {
34015
34020
  target_checkbox_box: openInNewTabCheckbox,
34016
34021
  nofollow_checkbox_box: noFollowCheckbox
34017
34022
  })
34018
- : html, htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
34019
- const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.refs)(htmlForm), { insert, unlink, content_input_box } = elements, { target_checkbox, nofollow_checkbox, url_input } = elements, currentElement = current, isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isImage(currentElement);
34023
+ : html;
34024
+ const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
34025
+ const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.refs)(htmlForm);
34026
+ const { insert, unlink, content_input_box } = elements;
34027
+ const { target_checkbox, nofollow_checkbox, url_input } = elements;
34028
+ const currentElement = current;
34029
+ const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isImage(currentElement);
34020
34030
  let { content_input } = elements;
34021
34031
  const { className_input } = elements, { className_select } = elements;
34022
34032
  if (!content_input) {
@@ -34087,7 +34097,7 @@ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .
34087
34097
  jodit.history.snapshot.restore(snapshot);
34088
34098
  const textWasChanged = getSelectionText() !== content_input.value.trim();
34089
34099
  const ci = jodit.createInside;
34090
- if (!link) {
34100
+ if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isOrContains(jodit.editor, link)) {
34091
34101
  if (!jodit.s.isCollapsed()) {
34092
34102
  const node = jodit.s.current();
34093
34103
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTag(node, 'img')) {