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/es5/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
  */
@@ -1838,7 +1838,7 @@ __webpack_require__.r(__webpack_exports__);
1838
1838
  * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
1839
1839
  */
1840
1840
 
1841
- var APP_VERSION = "4.2.34";
1841
+ var APP_VERSION = "4.2.37";
1842
1842
  // prettier-ignore
1843
1843
  var ES = "es5";
1844
1844
  var IS_ES_MODERN = false;
@@ -11142,11 +11142,7 @@ var Selection = /** @class */ (function () {
11142
11142
  String(dw).indexOf('%') < 0) {
11143
11143
  dw += 'px';
11144
11144
  }
11145
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.call)(
11146
- // @ts-ignore
11147
- this.j.o.resizer.forImageChangeAttributes ? jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr : jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.css, image, 'width',
11148
- // @ts-ignore
11149
- dw);
11145
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr)(image, 'width', dw);
11150
11146
  }
11151
11147
  if (styles && typeof styles === 'object') {
11152
11148
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.css)(image, styles);
@@ -11169,7 +11165,7 @@ var Selection = /** @class */ (function () {
11169
11165
  * [[FileBrowser]] or [[Uploader]]
11170
11166
  * @example
11171
11167
  * ```javascript
11172
- * var editor = Jodit.make("#redactor");
11168
+ * const editor = Jodit.make("#redactor");
11173
11169
  * editor.e.on('afterInsertImage', function (image) {
11174
11170
  * image.className = 'bloghead4';
11175
11171
  * });
@@ -21973,7 +21969,7 @@ var History = /** @class */ (function (_super) {
21973
21969
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(31635);
21974
21970
  /* harmony import */ var jodit_core_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77753);
21975
21971
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17352);
21976
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(71842);
21972
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55186);
21977
21973
  /*!
21978
21974
  * Jodit Editor (https://xdsoft.net/jodit/)
21979
21975
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -22019,7 +22015,7 @@ var Snapshot = /** @class */ (function (_super) {
22019
22015
  for (var j = 0; j < elms.length; j += 1) {
22020
22016
  if (previous &&
22021
22017
  !this.isIgnoredNode(elms[j]) &&
22022
- !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(previous) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elms[j]))) {
22018
+ !(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]))) {
22023
22019
  count += 1;
22024
22020
  }
22025
22021
  if (elms[j] === elm) {
@@ -22033,9 +22029,9 @@ var Snapshot = /** @class */ (function (_super) {
22033
22029
  * Calc normal offset in joined text nodes
22034
22030
  */
22035
22031
  Snapshot.strokeOffset = function (elm, offset) {
22036
- while (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
22032
+ while (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm)) {
22037
22033
  elm = elm.previousSibling;
22038
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
22034
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isText(elm) && elm.nodeValue) {
22039
22035
  offset += elm.nodeValue.length;
22040
22036
  }
22041
22037
  }
@@ -22046,7 +22042,7 @@ var Snapshot = /** @class */ (function (_super) {
22046
22042
  */
22047
22043
  Snapshot.prototype.calcHierarchyLadder = function (elm) {
22048
22044
  var counts = [];
22049
- if (!elm || !elm.parentNode || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
22045
+ if (!elm || !elm.parentNode || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.isOrContains(this.j.editor, elm)) {
22050
22046
  return [];
22051
22047
  }
22052
22048
  while (elm && elm !== this.j.editor) {
@@ -22102,10 +22098,12 @@ var Snapshot = /** @class */ (function (_super) {
22102
22098
  endOffset: 0
22103
22099
  }
22104
22100
  };
22105
- snapshot.html = this.removeJoditSelection(this.j.editor);
22101
+ snapshot.html = this.__getCleanedEditorValue(this.j.editor);
22106
22102
  var sel = this.j.s.sel;
22107
22103
  if (sel && sel.rangeCount) {
22108
- var range = sel.getRangeAt(0), startContainer = this.calcHierarchyLadder(range.startContainer), endContainer = this.calcHierarchyLadder(range.endContainer);
22104
+ var range = sel.getRangeAt(0);
22105
+ var startContainer = this.calcHierarchyLadder(range.startContainer);
22106
+ var endContainer = this.calcHierarchyLadder(range.endContainer);
22109
22107
  var startOffset = Snapshot.strokeOffset(range.startContainer, range.startOffset), endOffset = Snapshot.strokeOffset(range.endContainer, range.endOffset);
22110
22108
  if (!startContainer.length &&
22111
22109
  range.startContainer !== this.j.editor) {
@@ -22133,8 +22131,8 @@ var Snapshot = /** @class */ (function (_super) {
22133
22131
  var _this = this;
22134
22132
  this.transaction(function () {
22135
22133
  var scroll = _this.storeScrollState();
22136
- var value = _this.j.getNativeEditorValue();
22137
- if (value !== snapshot.html) {
22134
+ var html = _this.__getCleanedEditorValue(_this.j.editor);
22135
+ if (html !== snapshot.html) {
22138
22136
  _this.j.value = snapshot.html;
22139
22137
  }
22140
22138
  _this.restoreOnlySelection(snapshot);
@@ -22178,11 +22176,11 @@ var Snapshot = /** @class */ (function (_super) {
22178
22176
  _super.prototype.destruct.call(this);
22179
22177
  };
22180
22178
  Snapshot.isIgnoredNode = function (node) {
22181
- 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);
22179
+ 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);
22182
22180
  };
22183
- Snapshot.prototype.removeJoditSelection = function (node) {
22181
+ Snapshot.prototype.__getCleanedEditorValue = function (node) {
22184
22182
  var clone = node.cloneNode(true);
22185
- clone.querySelectorAll("[".concat(jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.TEMP_ATTR, "]")).forEach(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
22183
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.temporaryList(clone).forEach(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__/* .Dom */ .J.unwrap);
22186
22184
  return clone.innerHTML;
22187
22185
  };
22188
22186
  return Snapshot;
@@ -36359,13 +36357,19 @@ var link = /** @class */ (function (_super) {
36359
36357
  link.prototype.__generateForm = function (current, close) {
36360
36358
  var jodit = this.jodit;
36361
36359
  var i18n = jodit.i18n.bind(jodit), _a = jodit.o.link, openInNewTabCheckbox = _a.openInNewTabCheckbox, noFollowCheckbox = _a.noFollowCheckbox, formTemplate = _a.formTemplate, formClassName = _a.formClassName, modeClassName = _a.modeClassName;
36362
- var html = formTemplate(jodit), form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
36360
+ var html = formTemplate(jodit);
36361
+ var form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)
36363
36362
  ? jodit.c.fromHTML(html, {
36364
36363
  target_checkbox_box: openInNewTabCheckbox,
36365
36364
  nofollow_checkbox_box: noFollowCheckbox
36366
36365
  })
36367
- : html, htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
36368
- var elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.refs)(htmlForm), insert = elements.insert, unlink = elements.unlink, content_input_box = elements.content_input_box, _b = elements, target_checkbox = _b.target_checkbox, nofollow_checkbox = _b.nofollow_checkbox, url_input = _b.url_input, currentElement = current, isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isImage(currentElement);
36366
+ : html;
36367
+ var htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(form) ? form : form.container;
36368
+ var elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.refs)(htmlForm);
36369
+ var insert = elements.insert, unlink = elements.unlink, content_input_box = elements.content_input_box;
36370
+ var _b = elements, target_checkbox = _b.target_checkbox, nofollow_checkbox = _b.nofollow_checkbox, url_input = _b.url_input;
36371
+ var currentElement = current;
36372
+ var isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isImage(currentElement);
36369
36373
  var content_input = elements.content_input;
36370
36374
  var className_input = elements.className_input, className_select = elements.className_select;
36371
36375
  if (!content_input) {
@@ -36438,7 +36442,7 @@ var link = /** @class */ (function (_super) {
36438
36442
  jodit.history.snapshot.restore(snapshot);
36439
36443
  var textWasChanged = getSelectionText() !== content_input.value.trim();
36440
36444
  var ci = jodit.createInside;
36441
- if (!link) {
36445
+ if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isOrContains(jodit.editor, link)) {
36442
36446
  if (!jodit.s.isCollapsed()) {
36443
36447
  var node = jodit.s.current();
36444
36448
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTag(node, 'img')) {
@@ -39129,6 +39133,16 @@ var resizer = /** @class */ (function (_super) {
39129
39133
  node = node.parentNode;
39130
39134
  }
39131
39135
  };
39136
+ resizer.prototype.__afterInsertImage = function (image) {
39137
+ if (this.j.o.resizer.forImageChangeAttributes) {
39138
+ return;
39139
+ }
39140
+ var width = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(image, 'width');
39141
+ if (width && !(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.css)(image, 'width', true)) {
39142
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.css)(image, 'width', width);
39143
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(image, 'width', null);
39144
+ }
39145
+ };
39132
39146
  resizer.prototype.addEventListeners = function () {
39133
39147
  var _this = this;
39134
39148
  var editor = this.j;
@@ -39425,6 +39439,9 @@ var resizer = /** @class */ (function (_super) {
39425
39439
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
39426
39440
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)(':click')
39427
39441
  ], resizer.prototype, "onEditorClick", null);
39442
+ (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
39443
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.watch)(':afterInsertImage')
39444
+ ], resizer.prototype, "__afterInsertImage", null);
39428
39445
  (0,tslib__WEBPACK_IMPORTED_MODULE_7__/* .__decorate */ .Cg)([
39429
39446
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.autobind
39430
39447
  ], resizer.prototype, "onStartResizing", null);
package/es5/jodit.min.css CHANGED
@@ -1,14 +1,14 @@
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
  */
8
8
  /*!
9
9
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
10
10
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
11
- * Version: v4.2.34
11
+ * Version: v4.2.37
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */