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
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.34
4
+ * Version: v4.2.37
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.34";
1738
+ const APP_VERSION = "4.2.37";
1739
1739
  // prettier-ignore
1740
1740
  const ES = "es2018";
1741
1741
  const IS_ES_MODERN = true;
@@ -10643,11 +10643,7 @@ class Selection {
10643
10643
  String(dw).indexOf('%') < 0) {
10644
10644
  dw += 'px';
10645
10645
  }
10646
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.call)(
10647
- // @ts-ignore
10648
- this.j.o.resizer.forImageChangeAttributes ? jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr : jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.css, image, 'width',
10649
- // @ts-ignore
10650
- dw);
10646
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr)(image, 'width', dw);
10651
10647
  }
10652
10648
  if (styles && typeof styles === 'object') {
10653
10649
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.css)(image, styles);
@@ -10670,7 +10666,7 @@ class Selection {
10670
10666
  * [[FileBrowser]] or [[Uploader]]
10671
10667
  * @example
10672
10668
  * ```javascript
10673
- * var editor = Jodit.make("#redactor");
10669
+ * const editor = Jodit.make("#redactor");
10674
10670
  * editor.e.on('afterInsertImage', function (image) {
10675
10671
  * image.className = 'bloghead4';
10676
10672
  * });
@@ -20920,7 +20916,7 @@ class History extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .ViewC
20920
20916
  /* harmony export */ });
20921
20917
  /* harmony import */ var jodit_core_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77753);
20922
20918
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17352);
20923
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(71842);
20919
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55186);
20924
20920
  /*!
20925
20921
  * Jodit Editor (https://xdsoft.net/jodit/)
20926
20922
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -20963,7 +20959,7 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20963
20959
  for (let j = 0; j < elms.length; j += 1) {
20964
20960
  if (previous &&
20965
20961
  !this.isIgnoredNode(elms[j]) &&
20966
- !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(previous) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elms[j]))) {
20962
+ !(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]))) {
20967
20963
  count += 1;
20968
20964
  }
20969
20965
  if (elms[j] === elm) {
@@ -20977,9 +20973,9 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20977
20973
  * Calc normal offset in joined text nodes
20978
20974
  */
20979
20975
  static strokeOffset(elm, offset) {
20980
- while (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
20976
+ while (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
20981
20977
  elm = elm.previousSibling;
20982
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
20978
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
20983
20979
  offset += elm.nodeValue.length;
20984
20980
  }
20985
20981
  }
@@ -20990,7 +20986,7 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20990
20986
  */
20991
20987
  calcHierarchyLadder(elm) {
20992
20988
  const counts = [];
20993
- if (!elm || !elm.parentNode || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
20989
+ if (!elm || !elm.parentNode || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
20994
20990
  return [];
20995
20991
  }
20996
20992
  while (elm && elm !== this.j.editor) {
@@ -21042,10 +21038,12 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
21042
21038
  endOffset: 0
21043
21039
  }
21044
21040
  };
21045
- snapshot.html = this.removeJoditSelection(this.j.editor);
21041
+ snapshot.html = this.__getCleanedEditorValue(this.j.editor);
21046
21042
  const sel = this.j.s.sel;
21047
21043
  if (sel && sel.rangeCount) {
21048
- const range = sel.getRangeAt(0), startContainer = this.calcHierarchyLadder(range.startContainer), endContainer = this.calcHierarchyLadder(range.endContainer);
21044
+ const range = sel.getRangeAt(0);
21045
+ const startContainer = this.calcHierarchyLadder(range.startContainer);
21046
+ const endContainer = this.calcHierarchyLadder(range.endContainer);
21049
21047
  let startOffset = Snapshot.strokeOffset(range.startContainer, range.startOffset), endOffset = Snapshot.strokeOffset(range.endContainer, range.endOffset);
21050
21048
  if (!startContainer.length &&
21051
21049
  range.startContainer !== this.j.editor) {
@@ -21072,8 +21070,8 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
21072
21070
  restore(snapshot) {
21073
21071
  this.transaction(() => {
21074
21072
  const scroll = this.storeScrollState();
21075
- const value = this.j.getNativeEditorValue();
21076
- if (value !== snapshot.html) {
21073
+ const html = this.__getCleanedEditorValue(this.j.editor);
21074
+ if (html !== snapshot.html) {
21077
21075
  this.j.value = snapshot.html;
21078
21076
  }
21079
21077
  this.restoreOnlySelection(snapshot);
@@ -21117,11 +21115,11 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
21117
21115
  super.destruct();
21118
21116
  }
21119
21117
  static isIgnoredNode(node) {
21120
- 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);
21118
+ 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);
21121
21119
  }
21122
- removeJoditSelection(node) {
21120
+ __getCleanedEditorValue(node) {
21123
21121
  const clone = node.cloneNode(true);
21124
- clone.querySelectorAll(`[${jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.TEMP_ATTR}]`).forEach(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
21122
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.temporaryList(clone).forEach(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
21125
21123
  return clone.innerHTML;
21126
21124
  }
21127
21125
  }
@@ -35001,13 +34999,19 @@ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .
35001
34999
  __generateForm(current, close) {
35002
35000
  const { jodit } = this;
35003
35001
  const i18n = jodit.i18n.bind(jodit), { openInNewTabCheckbox, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
35004
- const html = formTemplate(jodit), form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
35002
+ const html = formTemplate(jodit);
35003
+ const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
35005
35004
  ? jodit.c.fromHTML(html, {
35006
35005
  target_checkbox_box: openInNewTabCheckbox,
35007
35006
  nofollow_checkbox_box: noFollowCheckbox
35008
35007
  })
35009
- : html, htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
35010
- 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);
35008
+ : html;
35009
+ const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
35010
+ const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.refs)(htmlForm);
35011
+ const { insert, unlink, content_input_box } = elements;
35012
+ const { target_checkbox, nofollow_checkbox, url_input } = elements;
35013
+ const currentElement = current;
35014
+ const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isImage(currentElement);
35011
35015
  let { content_input } = elements;
35012
35016
  const { className_input } = elements, { className_select } = elements;
35013
35017
  if (!content_input) {
@@ -35078,7 +35082,7 @@ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .
35078
35082
  jodit.history.snapshot.restore(snapshot);
35079
35083
  const textWasChanged = getSelectionText() !== content_input.value.trim();
35080
35084
  const ci = jodit.createInside;
35081
- if (!link) {
35085
+ if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isOrContains(jodit.editor, link)) {
35082
35086
  if (!jodit.s.isCollapsed()) {
35083
35087
  const node = jodit.s.current();
35084
35088
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTag(node, 'img')) {
@@ -37662,6 +37666,16 @@ class resizer extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_5__/* .P
37662
37666
  node = node.parentNode;
37663
37667
  }
37664
37668
  }
37669
+ __afterInsertImage(image) {
37670
+ if (this.j.o.resizer.forImageChangeAttributes) {
37671
+ return;
37672
+ }
37673
+ const width = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(image, 'width');
37674
+ if (width && !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.css)(image, 'width', true)) {
37675
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.css)(image, 'width', width);
37676
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(image, 'width', null);
37677
+ }
37678
+ }
37665
37679
  addEventListeners() {
37666
37680
  const editor = this.j;
37667
37681
  editor.e
@@ -37957,6 +37971,9 @@ class resizer extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_5__/* .P
37957
37971
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
37958
37972
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)(':click')
37959
37973
  ], resizer.prototype, "onEditorClick", null);
37974
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
37975
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)(':afterInsertImage')
37976
+ ], resizer.prototype, "__afterInsertImage", null);
37960
37977
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
37961
37978
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.autobind
37962
37979
  ], resizer.prototype, "onStartResizing", null);