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/es2015/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 = "es2015";
1741
1741
  const IS_ES_MODERN = true;
@@ -10655,11 +10655,7 @@ class Selection {
10655
10655
  String(dw).indexOf('%') < 0) {
10656
10656
  dw += 'px';
10657
10657
  }
10658
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.call)(
10659
- // @ts-ignore
10660
- this.j.o.resizer.forImageChangeAttributes ? jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr : jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.css, image, 'width',
10661
- // @ts-ignore
10662
- dw);
10658
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr)(image, 'width', dw);
10663
10659
  }
10664
10660
  if (styles && typeof styles === 'object') {
10665
10661
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.css)(image, styles);
@@ -10682,7 +10678,7 @@ class Selection {
10682
10678
  * [[FileBrowser]] or [[Uploader]]
10683
10679
  * @example
10684
10680
  * ```javascript
10685
- * var editor = Jodit.make("#redactor");
10681
+ * const editor = Jodit.make("#redactor");
10686
10682
  * editor.e.on('afterInsertImage', function (image) {
10687
10683
  * image.className = 'bloghead4';
10688
10684
  * });
@@ -20854,7 +20850,7 @@ class History extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .ViewC
20854
20850
  /* harmony export */ });
20855
20851
  /* harmony import */ var jodit_core_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77753);
20856
20852
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17352);
20857
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(71842);
20853
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55186);
20858
20854
  /*!
20859
20855
  * Jodit Editor (https://xdsoft.net/jodit/)
20860
20856
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -20897,7 +20893,7 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20897
20893
  for (let j = 0; j < elms.length; j += 1) {
20898
20894
  if (previous &&
20899
20895
  !this.isIgnoredNode(elms[j]) &&
20900
- !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(previous) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elms[j]))) {
20896
+ !(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]))) {
20901
20897
  count += 1;
20902
20898
  }
20903
20899
  if (elms[j] === elm) {
@@ -20911,9 +20907,9 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20911
20907
  * Calc normal offset in joined text nodes
20912
20908
  */
20913
20909
  static strokeOffset(elm, offset) {
20914
- while (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
20910
+ while (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
20915
20911
  elm = elm.previousSibling;
20916
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
20912
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
20917
20913
  offset += elm.nodeValue.length;
20918
20914
  }
20919
20915
  }
@@ -20924,7 +20920,7 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20924
20920
  */
20925
20921
  calcHierarchyLadder(elm) {
20926
20922
  const counts = [];
20927
- if (!elm || !elm.parentNode || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
20923
+ if (!elm || !elm.parentNode || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
20928
20924
  return [];
20929
20925
  }
20930
20926
  while (elm && elm !== this.j.editor) {
@@ -20976,10 +20972,12 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
20976
20972
  endOffset: 0
20977
20973
  }
20978
20974
  };
20979
- snapshot.html = this.removeJoditSelection(this.j.editor);
20975
+ snapshot.html = this.__getCleanedEditorValue(this.j.editor);
20980
20976
  const sel = this.j.s.sel;
20981
20977
  if (sel && sel.rangeCount) {
20982
- const range = sel.getRangeAt(0), startContainer = this.calcHierarchyLadder(range.startContainer), endContainer = this.calcHierarchyLadder(range.endContainer);
20978
+ const range = sel.getRangeAt(0);
20979
+ const startContainer = this.calcHierarchyLadder(range.startContainer);
20980
+ const endContainer = this.calcHierarchyLadder(range.endContainer);
20983
20981
  let startOffset = Snapshot.strokeOffset(range.startContainer, range.startOffset), endOffset = Snapshot.strokeOffset(range.endContainer, range.endOffset);
20984
20982
  if (!startContainer.length &&
20985
20983
  range.startContainer !== this.j.editor) {
@@ -21006,8 +21004,8 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
21006
21004
  restore(snapshot) {
21007
21005
  this.transaction(() => {
21008
21006
  const scroll = this.storeScrollState();
21009
- const value = this.j.getNativeEditorValue();
21010
- if (value !== snapshot.html) {
21007
+ const html = this.__getCleanedEditorValue(this.j.editor);
21008
+ if (html !== snapshot.html) {
21011
21009
  this.j.value = snapshot.html;
21012
21010
  }
21013
21011
  this.restoreOnlySelection(snapshot);
@@ -21051,11 +21049,11 @@ class Snapshot extends jodit_core_component__WEBPACK_IMPORTED_MODULE_0__/* .View
21051
21049
  super.destruct();
21052
21050
  }
21053
21051
  static isIgnoredNode(node) {
21054
- 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);
21052
+ 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);
21055
21053
  }
21056
- removeJoditSelection(node) {
21054
+ __getCleanedEditorValue(node) {
21057
21055
  const clone = node.cloneNode(true);
21058
- clone.querySelectorAll(`[${jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.TEMP_ATTR}]`).forEach(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
21056
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.temporaryList(clone).forEach(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
21059
21057
  return clone.innerHTML;
21060
21058
  }
21061
21059
  }
@@ -34928,13 +34926,19 @@ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .
34928
34926
  __generateForm(current, close) {
34929
34927
  const { jodit } = this;
34930
34928
  const i18n = jodit.i18n.bind(jodit), { openInNewTabCheckbox, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
34931
- const html = formTemplate(jodit), form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
34929
+ const html = formTemplate(jodit);
34930
+ const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
34932
34931
  ? jodit.c.fromHTML(html, {
34933
34932
  target_checkbox_box: openInNewTabCheckbox,
34934
34933
  nofollow_checkbox_box: noFollowCheckbox
34935
34934
  })
34936
- : html, htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
34937
- 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);
34935
+ : html;
34936
+ const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
34937
+ const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.refs)(htmlForm);
34938
+ const { insert, unlink, content_input_box } = elements;
34939
+ const { target_checkbox, nofollow_checkbox, url_input } = elements;
34940
+ const currentElement = current;
34941
+ const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isImage(currentElement);
34938
34942
  let { content_input } = elements;
34939
34943
  const { className_input } = elements, { className_select } = elements;
34940
34944
  if (!content_input) {
@@ -35005,7 +35009,7 @@ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .
35005
35009
  jodit.history.snapshot.restore(snapshot);
35006
35010
  const textWasChanged = getSelectionText() !== content_input.value.trim();
35007
35011
  const ci = jodit.createInside;
35008
- if (!link) {
35012
+ if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isOrContains(jodit.editor, link)) {
35009
35013
  if (!jodit.s.isCollapsed()) {
35010
35014
  const node = jodit.s.current();
35011
35015
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTag(node, 'img')) {
@@ -37593,6 +37597,16 @@ class resizer extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_5__/* .P
37593
37597
  node = node.parentNode;
37594
37598
  }
37595
37599
  }
37600
+ __afterInsertImage(image) {
37601
+ if (this.j.o.resizer.forImageChangeAttributes) {
37602
+ return;
37603
+ }
37604
+ const width = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(image, 'width');
37605
+ if (width && !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.css)(image, 'width', true)) {
37606
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.css)(image, 'width', width);
37607
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(image, 'width', null);
37608
+ }
37609
+ }
37596
37610
  addEventListeners() {
37597
37611
  const editor = this.j;
37598
37612
  editor.e
@@ -37888,6 +37902,9 @@ class resizer extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_5__/* .P
37888
37902
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
37889
37903
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)(':click')
37890
37904
  ], resizer.prototype, "onEditorClick", null);
37905
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
37906
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)(':afterInsertImage')
37907
+ ], resizer.prototype, "__afterInsertImage", null);
37891
37908
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
37892
37909
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.autobind
37893
37910
  ], resizer.prototype, "onStartResizing", null);