jodit 4.6.6 → 4.6.11

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 (69) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +161 -25
  5. package/es2015/jodit.min.js +2 -2
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.css +1 -1
  13. package/es2018/jodit.fat.min.js +2 -2
  14. package/es2018/jodit.js +161 -25
  15. package/es2018/jodit.min.js +2 -2
  16. package/es2018/plugins/debug/debug.css +1 -1
  17. package/es2018/plugins/debug/debug.js +1 -1
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  20. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  21. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  22. package/es2021/jodit.css +1 -1
  23. package/es2021/jodit.fat.min.js +2 -2
  24. package/es2021/jodit.js +161 -25
  25. package/es2021/jodit.min.js +2 -2
  26. package/es2021/plugins/debug/debug.css +1 -1
  27. package/es2021/plugins/debug/debug.js +1 -1
  28. package/es2021/plugins/debug/debug.min.js +1 -1
  29. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  30. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  32. package/es2021.en/jodit.css +1 -1
  33. package/es2021.en/jodit.fat.min.js +2 -2
  34. package/es2021.en/jodit.js +161 -25
  35. package/es2021.en/jodit.min.js +2 -2
  36. package/es2021.en/plugins/debug/debug.css +1 -1
  37. package/es2021.en/plugins/debug/debug.js +1 -1
  38. package/es2021.en/plugins/debug/debug.min.js +1 -1
  39. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  40. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  42. package/es5/415.fat.min.js +1 -1
  43. package/es5/415.min.js +1 -1
  44. package/es5/5.fat.min.js +1 -1
  45. package/es5/5.min.js +1 -1
  46. package/es5/jodit.css +2 -2
  47. package/es5/jodit.fat.min.js +2 -2
  48. package/es5/jodit.js +161 -25
  49. package/es5/jodit.min.css +2 -2
  50. package/es5/jodit.min.js +2 -2
  51. package/es5/plugins/debug/debug.css +1 -1
  52. package/es5/plugins/debug/debug.js +1 -1
  53. package/es5/plugins/debug/debug.min.js +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  56. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  57. package/esm/core/constants.js +1 -1
  58. package/esm/core/helpers/array/index.d.ts +1 -0
  59. package/esm/core/helpers/array/index.js +1 -0
  60. package/esm/core/helpers/array/reconcile-arrays.d.ts +54 -0
  61. package/esm/core/helpers/array/reconcile-arrays.js +103 -0
  62. package/esm/core/ui/group/group.d.ts +4 -2
  63. package/esm/core/ui/group/group.js +31 -14
  64. package/esm/types/ui.d.ts +4 -1
  65. package/package.json +1 -1
  66. package/types/core/helpers/array/index.d.ts +1 -0
  67. package/types/core/helpers/array/reconcile-arrays.d.ts +54 -0
  68. package/types/core/ui/group/group.d.ts +4 -2
  69. package/types/types/ui.d.ts +4 -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.6.6
4
+ * Version: v4.6.11
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -3433,9 +3433,7 @@ function brBefore(start) {
3433
3433
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22664);
3434
3434
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(55186);
3435
3435
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65147);
3436
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28712);
3437
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_5__);
3438
- /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(29780);
3436
+ /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29780);
3439
3437
  /*!
3440
3438
  * Jodit Editor (https://xdsoft.net/jodit/)
3441
3439
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -3449,8 +3447,7 @@ var UIGroup_1;
3449
3447
 
3450
3448
 
3451
3449
 
3452
-
3453
- let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_6__/* .UIElement */ .D {
3450
+ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_5__/* .UIElement */ .D {
3454
3451
  className() {
3455
3452
  return 'UIGroup';
3456
3453
  }
@@ -3483,25 +3480,35 @@ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_I
3483
3480
  this.elements.forEach(elm => elm.update());
3484
3481
  this.setMod('size', this.buttonSize);
3485
3482
  }
3486
- /**
3487
- * Append new element into group
3488
- */
3489
- append(elm, distElement) {
3490
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isArray)(elm)) {
3491
- elm.forEach(item => this.append(item, distElement));
3483
+ append(elms, distElementOrIndex) {
3484
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isArray)(elms)) {
3485
+ if (typeof distElementOrIndex === 'number') {
3486
+ throw new Error('You can not use index when append array of elements');
3487
+ }
3488
+ elms.forEach(item => this.append(item, distElementOrIndex));
3492
3489
  return this;
3493
3490
  }
3494
- this.elements.push(elm);
3491
+ const elm = elms;
3492
+ let index = undefined;
3493
+ if (typeof distElementOrIndex === 'number') {
3494
+ index = Math.min(Math.max(0, distElementOrIndex), this.elements.length);
3495
+ this.elements.splice(index, 0, elm);
3496
+ }
3497
+ else {
3498
+ this.elements.push(elm);
3499
+ }
3495
3500
  if (elm.name) {
3496
3501
  elm.container.classList.add(this.getFullElName(elm.name));
3497
3502
  }
3498
- if (distElement) {
3499
- const distElm = this.getElm(distElement);
3500
- void 0;
3503
+ if (distElementOrIndex && typeof distElementOrIndex === 'string') {
3504
+ const distElm = this.getElm(distElementOrIndex);
3505
+ if (distElm == null) {
3506
+ throw new Error('Element does not exist');
3507
+ }
3501
3508
  distElm.appendChild(elm.container);
3502
3509
  }
3503
3510
  else {
3504
- this.appendChildToContainer(elm.container);
3511
+ this.appendChildToContainer(elm.container, index);
3505
3512
  }
3506
3513
  elm.parentElement = this;
3507
3514
  return this;
@@ -3515,8 +3522,16 @@ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_I
3515
3522
  /**
3516
3523
  * Allow set another container for the box of all children
3517
3524
  */
3518
- appendChildToContainer(childContainer) {
3519
- this.container.appendChild(childContainer);
3525
+ appendChildToContainer(childContainer, index) {
3526
+ if (index === undefined ||
3527
+ index < 0 ||
3528
+ index > this.elements.length - 1 ||
3529
+ this.container.children[index] == null) {
3530
+ this.container.appendChild(childContainer);
3531
+ }
3532
+ else {
3533
+ this.container.insertBefore(childContainer, this.container.children[index]);
3534
+ }
3520
3535
  }
3521
3536
  /**
3522
3537
  * Remove element from group
@@ -8374,7 +8389,7 @@ __webpack_require__.r(__webpack_exports__);
8374
8389
  * Released under MIT see LICENSE.txt in the project root for license information.
8375
8390
  * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
8376
8391
  */
8377
- const APP_VERSION = "4.6.6";
8392
+ const APP_VERSION = "4.6.11";
8378
8393
  // prettier-ignore
8379
8394
  const ES = "es2018";
8380
8395
  const IS_ES_MODERN = true;
@@ -13994,13 +14009,16 @@ function observable(obj) {
13994
14009
 
13995
14010
  "use strict";
13996
14011
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13997
- /* harmony export */ $r: function() { return /* reexport safe */ _to_array__WEBPACK_IMPORTED_MODULE_2__.$; },
14012
+ /* harmony export */ $r: function() { return /* reexport safe */ _to_array__WEBPACK_IMPORTED_MODULE_3__.$; },
13998
14013
  /* harmony export */ _j: function() { return /* reexport safe */ _as_array__WEBPACK_IMPORTED_MODULE_0__._; },
13999
- /* harmony export */ uM: function() { return /* reexport safe */ _split_array__WEBPACK_IMPORTED_MODULE_1__.u; }
14014
+ /* harmony export */ ft: function() { return /* reexport safe */ _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__.f; },
14015
+ /* harmony export */ j5: function() { return /* reexport safe */ _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__.j; },
14016
+ /* harmony export */ uM: function() { return /* reexport safe */ _split_array__WEBPACK_IMPORTED_MODULE_2__.u; }
14000
14017
  /* harmony export */ });
14001
14018
  /* harmony import */ var _as_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82317);
14002
- /* harmony import */ var _split_array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(42589);
14003
- /* harmony import */ var _to_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42448);
14019
+ /* harmony import */ var _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(63784);
14020
+ /* harmony import */ var _split_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42589);
14021
+ /* harmony import */ var _to_array__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42448);
14004
14022
  /*!
14005
14023
  * Jodit Editor (https://xdsoft.net/jodit/)
14006
14024
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -14014,6 +14032,7 @@ function observable(obj) {
14014
14032
 
14015
14033
 
14016
14034
 
14035
+
14017
14036
  /***/ }),
14018
14037
 
14019
14038
  /***/ 32782:
@@ -29137,6 +29156,121 @@ function moveCursorOutFromSpecialTags(jodit, fake, tags) {
29137
29156
  }
29138
29157
 
29139
29158
 
29159
+ /***/ }),
29160
+
29161
+ /***/ 63784:
29162
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
29163
+
29164
+ "use strict";
29165
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
29166
+ /* harmony export */ f: function() { return /* binding */ applyArrayReconciliation; },
29167
+ /* harmony export */ j: function() { return /* binding */ reconcileArrays; }
29168
+ /* harmony export */ });
29169
+ /*!
29170
+ * Jodit Editor (https://xdsoft.net/jodit/)
29171
+ * Released under MIT see LICENSE.txt in the project root for license information.
29172
+ * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
29173
+ */
29174
+ /**
29175
+ * Reconciles two arrays and returns the differences
29176
+ * @param oldArray - The original array
29177
+ * @param newArray - The new array to compare against
29178
+ * @param keyFn - Optional function to generate unique keys for items (for object comparison)
29179
+ * @returns Object containing added, removed, kept and moved items
29180
+ *
29181
+ * @example
29182
+ * ```typescript
29183
+ * const old = [1, 2, 3, 4];
29184
+ * const new = [2, 4, 5, 1];
29185
+ * const result = reconcileArrays(old, new);
29186
+ * // result.added = [5]
29187
+ * // result.removed = [3]
29188
+ * // result.kept = [2, 4, 1]
29189
+ * // result.moved = [{item: 1, from: 0, to: 3}]
29190
+ * ```
29191
+ *
29192
+ * @example
29193
+ * ```typescript
29194
+ * const old = [{id: 1, name: 'a'}, {id: 2, name: 'b'}];
29195
+ * const new = [{id: 2, name: 'b'}, {id: 3, name: 'c'}];
29196
+ * const result = reconcileArrays(old, new, item => item.id);
29197
+ * // result.added = [{id: 3, name: 'c'}]
29198
+ * // result.removed = [{id: 1, name: 'a'}]
29199
+ * ```
29200
+ */
29201
+ function reconcileArrays(oldArray, newArray, keyFn) {
29202
+ const getKey = keyFn || ((item) => item);
29203
+ const oldMap = new Map();
29204
+ const newMap = new Map();
29205
+ oldArray.forEach((item, index) => {
29206
+ oldMap.set(getKey(item), { item, index });
29207
+ });
29208
+ newArray.forEach((item, index) => {
29209
+ newMap.set(getKey(item), { item, index });
29210
+ });
29211
+ const added = [];
29212
+ const removed = [];
29213
+ const kept = [];
29214
+ const moved = [];
29215
+ // Find removed items
29216
+ oldMap.forEach((value, key) => {
29217
+ if (!newMap.has(key)) {
29218
+ removed.push(value.item);
29219
+ }
29220
+ });
29221
+ // Find added items and track kept/moved items
29222
+ newMap.forEach((value, key) => {
29223
+ const oldItem = oldMap.get(key);
29224
+ if (!oldItem) {
29225
+ added.push(value.item);
29226
+ }
29227
+ else {
29228
+ kept.push(value.item);
29229
+ if (oldItem.index !== value.index) {
29230
+ moved.push({
29231
+ item: value.item,
29232
+ from: oldItem.index,
29233
+ to: value.index
29234
+ });
29235
+ }
29236
+ }
29237
+ });
29238
+ return {
29239
+ added,
29240
+ removed,
29241
+ kept,
29242
+ moved
29243
+ };
29244
+ }
29245
+ /**
29246
+ * Applies reconciliation patches to transform one array into another
29247
+ * @param oldArray - The original array to transform
29248
+ * @param newArray - The target array structure
29249
+ * @param keyFn - Optional function to generate unique keys for items
29250
+ * @returns New array matching the structure of newArray
29251
+ */
29252
+ function applyArrayReconciliation(oldArray, newArray, keyFn) {
29253
+ const result = reconcileArrays(oldArray, newArray, keyFn);
29254
+ const output = [];
29255
+ // Build the new array based on newArray order
29256
+ newArray.forEach(item => {
29257
+ const key = keyFn ? keyFn(item) : item;
29258
+ const isNew = result.added.some(addedItem => (keyFn ? keyFn(addedItem) : addedItem) === key);
29259
+ if (isNew) {
29260
+ output.push(item);
29261
+ }
29262
+ else {
29263
+ // Use the old item reference if it exists
29264
+ const oldItem = oldArray.find(oldItem => (keyFn ? keyFn(oldItem) : oldItem) === key);
29265
+ if (oldItem !== undefined) {
29266
+ output.push(oldItem);
29267
+ }
29268
+ }
29269
+ });
29270
+ return output;
29271
+ }
29272
+
29273
+
29140
29274
  /***/ }),
29141
29275
 
29142
29276
  /***/ 63837:
@@ -29705,6 +29839,7 @@ __webpack_require__.r(__webpack_exports__);
29705
29839
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
29706
29840
  /* harmony export */ CamelCaseToKebabCase: function() { return /* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_7__.N; },
29707
29841
  /* harmony export */ NUMBER_FIELDS_REG: function() { return /* reexport safe */ _normalize__WEBPACK_IMPORTED_MODULE_5__.b$; },
29842
+ /* harmony export */ applyArrayReconciliation: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__.ft; },
29708
29843
  /* harmony export */ applyStyles: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.ZM; },
29709
29844
  /* harmony export */ asArray: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__._j; },
29710
29845
  /* harmony export */ camelCase: function() { return /* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_7__.xQ; },
@@ -29759,6 +29894,7 @@ __webpack_require__.r(__webpack_exports__);
29759
29894
  /* harmony export */ normalizeUrl: function() { return /* reexport safe */ _normalize__WEBPACK_IMPORTED_MODULE_5__.l2; },
29760
29895
  /* harmony export */ offset: function() { return /* reexport safe */ _size__WEBPACK_IMPORTED_MODULE_6__.cY; },
29761
29896
  /* harmony export */ position: function() { return /* reexport safe */ _size__WEBPACK_IMPORTED_MODULE_6__.G1; },
29897
+ /* harmony export */ reconcileArrays: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__.j5; },
29762
29898
  /* harmony export */ safeHTML: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.t_; },
29763
29899
  /* harmony export */ sanitizeHTMLElement: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.vn; },
29764
29900
  /* harmony export */ setTimeout: function() { return /* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_1__.w; },
@@ -29783,7 +29919,7 @@ __webpack_require__.r(__webpack_exports__);
29783
29919
  /* harmony import */ var _string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6589);
29784
29920
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(97369);
29785
29921
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
29786
- /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _utils__WEBPACK_IMPORTED_MODULE_8__) if(["default","asArray","splitArray","toArray","clearTimeout","setTimeout","hasBrowserColorPicker","hasContainer","isAbortError","isArray","isBoolean","isDestructable","isEqual","isFastEqual","isFunction","isHTML","isHtmlFromWord","isInitable","isInt","isJoditObject","isLicense","isMarker","isNativeFunction","isNumber","isNumeric","isPlainObject","isPromise","isSet","isString","isStringArray","isURL","isValidName","isViewObject","isVoid","isWindow","colorToHex","applyStyles","cleanFromWord","htmlspecialchars","nl2br","safeHTML","sanitizeHTMLElement","stripTags","NUMBER_FIELDS_REG","normalizeColor","normalizeCssNumericValue","normalizeCssValue","normalizeKeyAliases","normalizeLicense","normalizePath","normalizeRelativePath","normalizeSize","normalizeUrl","getContentWidth","getScrollParent","innerWidth","offset","position","size","CamelCaseToKebabCase","camelCase","fuzzySearchIndex","i18n","kebabCase","sprintf","stringify","trim","trimChars","trimInv","ucfirst"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = function(key) { return _utils__WEBPACK_IMPORTED_MODULE_8__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
29922
+ /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _utils__WEBPACK_IMPORTED_MODULE_8__) if(["default","applyArrayReconciliation","asArray","reconcileArrays","splitArray","toArray","clearTimeout","setTimeout","hasBrowserColorPicker","hasContainer","isAbortError","isArray","isBoolean","isDestructable","isEqual","isFastEqual","isFunction","isHTML","isHtmlFromWord","isInitable","isInt","isJoditObject","isLicense","isMarker","isNativeFunction","isNumber","isNumeric","isPlainObject","isPromise","isSet","isString","isStringArray","isURL","isValidName","isViewObject","isVoid","isWindow","colorToHex","applyStyles","cleanFromWord","htmlspecialchars","nl2br","safeHTML","sanitizeHTMLElement","stripTags","NUMBER_FIELDS_REG","normalizeColor","normalizeCssNumericValue","normalizeCssValue","normalizeKeyAliases","normalizeLicense","normalizePath","normalizeRelativePath","normalizeSize","normalizeUrl","getContentWidth","getScrollParent","innerWidth","offset","position","size","CamelCaseToKebabCase","camelCase","fuzzySearchIndex","i18n","kebabCase","sprintf","stringify","trim","trimChars","trimInv","ucfirst"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = function(key) { return _utils__WEBPACK_IMPORTED_MODULE_8__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
29787
29923
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
29788
29924
  /*!
29789
29925
  * Jodit Editor (https://xdsoft.net/jodit/)