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
package/es2018/jodit.js CHANGED
@@ -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
  */
@@ -1735,7 +1735,7 @@ __webpack_require__.r(__webpack_exports__);
1735
1735
  * Released under MIT see LICENSE.txt in the project root for license information.
1736
1736
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1737
1737
  */
1738
- const APP_VERSION = "4.2.33";
1738
+ const APP_VERSION = "4.2.35";
1739
1739
  // prettier-ignore
1740
1740
  const ES = "es2018";
1741
1741
  const IS_ES_MODERN = true;
@@ -11845,7 +11845,9 @@ function unwrapList(mode, list, li, jodit, cs) {
11845
11845
  (0,jodit_core_selection_style_api_extract__WEBPACK_IMPORTED_MODULE_2__/* .extractSelectedPart */ .y)(list, li, jodit);
11846
11846
  void 0;
11847
11847
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.unwrap(li.parentElement);
11848
- return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.replace(li, jodit.o.enter, jodit.createInside);
11848
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__/* .Dom */ .J.replace(li, jodit.o.enter.toLowerCase() !== 'br'
11849
+ ? jodit.o.enter
11850
+ : jodit.createInside.fragment(), jodit.createInside);
11849
11851
  }
11850
11852
 
11851
11853
 
@@ -20918,7 +20920,7 @@ class History extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .ViewC
20918
20920
  /* harmony export */ });
20919
20921
  /* harmony import */ var jodit_core_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77753);
20920
20922
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17352);
20921
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(71842);
20923
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55186);
20922
20924
  /*!
20923
20925
  * Jodit Editor (https://xdsoft.net/jodit/)
20924
20926
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -20961,7 +20963,7 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20961
20963
  for (let j = 0; j < elms.length; j += 1) {
20962
20964
  if (previous &&
20963
20965
  !this.isIgnoredNode(elms[j]) &&
20964
- !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(previous) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elms[j]))) {
20966
+ !(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]))) {
20965
20967
  count += 1;
20966
20968
  }
20967
20969
  if (elms[j] === elm) {
@@ -20975,9 +20977,9 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20975
20977
  * Calc normal offset in joined text nodes
20976
20978
  */
20977
20979
  static strokeOffset(elm, offset) {
20978
- while (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
20980
+ while (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
20979
20981
  elm = elm.previousSibling;
20980
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
20982
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
20981
20983
  offset += elm.nodeValue.length;
20982
20984
  }
20983
20985
  }
@@ -20988,7 +20990,7 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20988
20990
  */
20989
20991
  calcHierarchyLadder(elm) {
20990
20992
  const counts = [];
20991
- if (!elm || !elm.parentNode || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
20993
+ if (!elm || !elm.parentNode || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
20992
20994
  return [];
20993
20995
  }
20994
20996
  while (elm && elm !== this.j.editor) {
@@ -21040,10 +21042,12 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
21040
21042
  endOffset: 0
21041
21043
  }
21042
21044
  };
21043
- snapshot.html = this.removeJoditSelection(this.j.editor);
21045
+ snapshot.html = this.__getCleanedEditorValue(this.j.editor);
21044
21046
  const sel = this.j.s.sel;
21045
21047
  if (sel && sel.rangeCount) {
21046
- const range = sel.getRangeAt(0), startContainer = this.calcHierarchyLadder(range.startContainer), endContainer = this.calcHierarchyLadder(range.endContainer);
21048
+ const range = sel.getRangeAt(0);
21049
+ const startContainer = this.calcHierarchyLadder(range.startContainer);
21050
+ const endContainer = this.calcHierarchyLadder(range.endContainer);
21047
21051
  let startOffset = Snapshot.strokeOffset(range.startContainer, range.startOffset), endOffset = Snapshot.strokeOffset(range.endContainer, range.endOffset);
21048
21052
  if (!startContainer.length &&
21049
21053
  range.startContainer !== this.j.editor) {
@@ -21070,8 +21074,8 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
21070
21074
  restore(snapshot) {
21071
21075
  this.transaction(() => {
21072
21076
  const scroll = this.storeScrollState();
21073
- const value = this.j.getNativeEditorValue();
21074
- if (value !== snapshot.html) {
21077
+ const html = this.__getCleanedEditorValue(this.j.editor);
21078
+ if (html !== snapshot.html) {
21075
21079
  this.j.value = snapshot.html;
21076
21080
  }
21077
21081
  this.restoreOnlySelection(snapshot);
@@ -21115,11 +21119,11 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
21115
21119
  super.destruct();
21116
21120
  }
21117
21121
  static isIgnoredNode(node) {
21118
- 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);
21122
+ 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);
21119
21123
  }
21120
- removeJoditSelection(node) {
21124
+ __getCleanedEditorValue(node) {
21121
21125
  const clone = node.cloneNode(true);
21122
- clone.querySelectorAll(`[${jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.TEMP_ATTR}]`).forEach(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
21126
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.temporaryList(clone).forEach(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
21123
21127
  return clone.innerHTML;
21124
21128
  }
21125
21129
  }
@@ -34999,13 +35003,19 @@ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .
34999
35003
  __generateForm(current, close) {
35000
35004
  const { jodit } = this;
35001
35005
  const i18n = jodit.i18n.bind(jodit), { openInNewTabCheckbox, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
35002
- const html = formTemplate(jodit), form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
35006
+ const html = formTemplate(jodit);
35007
+ const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
35003
35008
  ? jodit.c.fromHTML(html, {
35004
35009
  target_checkbox_box: openInNewTabCheckbox,
35005
35010
  nofollow_checkbox_box: noFollowCheckbox
35006
35011
  })
35007
- : html, htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
35008
- 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);
35012
+ : html;
35013
+ const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
35014
+ const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.refs)(htmlForm);
35015
+ const { insert, unlink, content_input_box } = elements;
35016
+ const { target_checkbox, nofollow_checkbox, url_input } = elements;
35017
+ const currentElement = current;
35018
+ const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isImage(currentElement);
35009
35019
  let { content_input } = elements;
35010
35020
  const { className_input } = elements, { className_select } = elements;
35011
35021
  if (!content_input) {
@@ -35076,7 +35086,7 @@ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .
35076
35086
  jodit.history.snapshot.restore(snapshot);
35077
35087
  const textWasChanged = getSelectionText() !== content_input.value.trim();
35078
35088
  const ci = jodit.createInside;
35079
- if (!link) {
35089
+ if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isOrContains(jodit.editor, link)) {
35080
35090
  if (!jodit.s.isCollapsed()) {
35081
35091
  const node = jodit.s.current();
35082
35092
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTag(node, 'img')) {