jodit 4.2.34 → 4.2.37

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 (61) 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 +41 -24
  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 +41 -24
  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 +41 -24
  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 +41 -24
  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 +41 -24
  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/selection.js +3 -7
  54. package/esm/modules/history/snapshot.d.ts +1 -1
  55. package/esm/modules/history/snapshot.js +10 -8
  56. package/esm/plugins/link/link.js +10 -4
  57. package/esm/plugins/resizer/resizer.d.ts +1 -0
  58. package/esm/plugins/resizer/resizer.js +13 -0
  59. package/package.json +1 -1
  60. package/types/modules/history/snapshot.d.ts +1 -1
  61. package/types/plugins/resizer/resizer.d.ts +1 -0
@@ -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.34
4
+ * Version: v4.2.37
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.34";
1739
+ const APP_VERSION = "4.2.37";
1740
1740
  // prettier-ignore
1741
1741
  const ES = "es2021";
1742
1742
  const IS_ES_MODERN = true;
@@ -10614,11 +10614,7 @@ class Selection {
10614
10614
  String(dw).indexOf('%') < 0) {
10615
10615
  dw += 'px';
10616
10616
  }
10617
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.call)(
10618
- // @ts-ignore
10619
- this.j.o.resizer.forImageChangeAttributes ? jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr : jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.css, image, 'width',
10620
- // @ts-ignore
10621
- dw);
10617
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr)(image, 'width', dw);
10622
10618
  }
10623
10619
  if (styles && typeof styles === 'object') {
10624
10620
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.css)(image, styles);
@@ -10641,7 +10637,7 @@ class Selection {
10641
10637
  * [[FileBrowser]] or [[Uploader]]
10642
10638
  * @example
10643
10639
  * ```javascript
10644
- * var editor = Jodit.make("#redactor");
10640
+ * const editor = Jodit.make("#redactor");
10645
10641
  * editor.e.on('afterInsertImage', function (image) {
10646
10642
  * image.className = 'bloghead4';
10647
10643
  * });
@@ -20835,7 +20831,7 @@ class History extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .ViewC
20835
20831
  /* harmony export */ });
20836
20832
  /* harmony import */ var jodit_core_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77753);
20837
20833
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17352);
20838
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(71842);
20834
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55186);
20839
20835
  /*!
20840
20836
  * Jodit Editor (https://xdsoft.net/jodit/)
20841
20837
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -20878,7 +20874,7 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20878
20874
  for (let j = 0; j < elms.length; j += 1) {
20879
20875
  if (previous &&
20880
20876
  !this.isIgnoredNode(elms[j]) &&
20881
- !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(previous) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elms[j]))) {
20877
+ !(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]))) {
20882
20878
  count += 1;
20883
20879
  }
20884
20880
  if (elms[j] === elm) {
@@ -20892,9 +20888,9 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20892
20888
  * Calc normal offset in joined text nodes
20893
20889
  */
20894
20890
  static strokeOffset(elm, offset) {
20895
- while (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
20891
+ while (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
20896
20892
  elm = elm.previousSibling;
20897
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
20893
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
20898
20894
  offset += elm.nodeValue.length;
20899
20895
  }
20900
20896
  }
@@ -20905,7 +20901,7 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20905
20901
  */
20906
20902
  calcHierarchyLadder(elm) {
20907
20903
  const counts = [];
20908
- if (!elm || !elm.parentNode || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
20904
+ if (!elm || !elm.parentNode || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
20909
20905
  return [];
20910
20906
  }
20911
20907
  while (elm && elm !== this.j.editor) {
@@ -20957,10 +20953,12 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20957
20953
  endOffset: 0
20958
20954
  }
20959
20955
  };
20960
- snapshot.html = this.removeJoditSelection(this.j.editor);
20956
+ snapshot.html = this.__getCleanedEditorValue(this.j.editor);
20961
20957
  const sel = this.j.s.sel;
20962
20958
  if (sel && sel.rangeCount) {
20963
- const range = sel.getRangeAt(0), startContainer = this.calcHierarchyLadder(range.startContainer), endContainer = this.calcHierarchyLadder(range.endContainer);
20959
+ const range = sel.getRangeAt(0);
20960
+ const startContainer = this.calcHierarchyLadder(range.startContainer);
20961
+ const endContainer = this.calcHierarchyLadder(range.endContainer);
20964
20962
  let startOffset = Snapshot.strokeOffset(range.startContainer, range.startOffset), endOffset = Snapshot.strokeOffset(range.endContainer, range.endOffset);
20965
20963
  if (!startContainer.length &&
20966
20964
  range.startContainer !== this.j.editor) {
@@ -20987,8 +20985,8 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20987
20985
  restore(snapshot) {
20988
20986
  this.transaction(() => {
20989
20987
  const scroll = this.storeScrollState();
20990
- const value = this.j.getNativeEditorValue();
20991
- if (value !== snapshot.html) {
20988
+ const html = this.__getCleanedEditorValue(this.j.editor);
20989
+ if (html !== snapshot.html) {
20992
20990
  this.j.value = snapshot.html;
20993
20991
  }
20994
20992
  this.restoreOnlySelection(snapshot);
@@ -21032,11 +21030,11 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
21032
21030
  super.destruct();
21033
21031
  }
21034
21032
  static isIgnoredNode(node) {
21035
- 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);
21033
+ 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);
21036
21034
  }
21037
- removeJoditSelection(node) {
21035
+ __getCleanedEditorValue(node) {
21038
21036
  const clone = node.cloneNode(true);
21039
- clone.querySelectorAll(`[${jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.TEMP_ATTR}]`).forEach(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
21037
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.temporaryList(clone).forEach(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
21040
21038
  return clone.innerHTML;
21041
21039
  }
21042
21040
  }
@@ -34012,13 +34010,19 @@ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .
34012
34010
  __generateForm(current, close) {
34013
34011
  const { jodit } = this;
34014
34012
  const i18n = jodit.i18n.bind(jodit), { openInNewTabCheckbox, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
34015
- const html = formTemplate(jodit), form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
34013
+ const html = formTemplate(jodit);
34014
+ const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
34016
34015
  ? jodit.c.fromHTML(html, {
34017
34016
  target_checkbox_box: openInNewTabCheckbox,
34018
34017
  nofollow_checkbox_box: noFollowCheckbox
34019
34018
  })
34020
- : html, htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
34021
- 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);
34019
+ : html;
34020
+ const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
34021
+ const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.refs)(htmlForm);
34022
+ const { insert, unlink, content_input_box } = elements;
34023
+ const { target_checkbox, nofollow_checkbox, url_input } = elements;
34024
+ const currentElement = current;
34025
+ const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isImage(currentElement);
34022
34026
  let { content_input } = elements;
34023
34027
  const { className_input } = elements, { className_select } = elements;
34024
34028
  if (!content_input) {
@@ -34089,7 +34093,7 @@ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .
34089
34093
  jodit.history.snapshot.restore(snapshot);
34090
34094
  const textWasChanged = getSelectionText() !== content_input.value.trim();
34091
34095
  const ci = jodit.createInside;
34092
- if (!link) {
34096
+ if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isOrContains(jodit.editor, link)) {
34093
34097
  if (!jodit.s.isCollapsed()) {
34094
34098
  const node = jodit.s.current();
34095
34099
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTag(node, 'img')) {
@@ -36670,6 +36674,16 @@ class resizer extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_5__/* .P
36670
36674
  node = node.parentNode;
36671
36675
  }
36672
36676
  }
36677
+ __afterInsertImage(image) {
36678
+ if (this.j.o.resizer.forImageChangeAttributes) {
36679
+ return;
36680
+ }
36681
+ const width = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(image, 'width');
36682
+ if (width && !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.css)(image, 'width', true)) {
36683
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.css)(image, 'width', width);
36684
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(image, 'width', null);
36685
+ }
36686
+ }
36673
36687
  addEventListeners() {
36674
36688
  const editor = this.j;
36675
36689
  editor.e
@@ -36965,6 +36979,9 @@ class resizer extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_5__/* .P
36965
36979
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
36966
36980
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)(':click')
36967
36981
  ], resizer.prototype, "onEditorClick", null);
36982
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
36983
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)(':afterInsertImage')
36984
+ ], resizer.prototype, "__afterInsertImage", null);
36968
36985
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
36969
36986
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.autobind
36970
36987
  ], resizer.prototype, "onStartResizing", null);