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/es2021/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
  */
@@ -3410,9 +3410,7 @@ function brBefore(start) {
3410
3410
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22664);
3411
3411
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(55186);
3412
3412
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65147);
3413
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28712);
3414
- /* 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__);
3415
- /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(29780);
3413
+ /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29780);
3416
3414
  /*!
3417
3415
  * Jodit Editor (https://xdsoft.net/jodit/)
3418
3416
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -3426,8 +3424,7 @@ var UIGroup_1;
3426
3424
 
3427
3425
 
3428
3426
 
3429
-
3430
- let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_6__/* .UIElement */ .D {
3427
+ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_5__/* .UIElement */ .D {
3431
3428
  className() {
3432
3429
  return 'UIGroup';
3433
3430
  }
@@ -3460,25 +3457,35 @@ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_I
3460
3457
  this.elements.forEach(elm => elm.update());
3461
3458
  this.setMod('size', this.buttonSize);
3462
3459
  }
3463
- /**
3464
- * Append new element into group
3465
- */
3466
- append(elm, distElement) {
3467
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isArray)(elm)) {
3468
- elm.forEach(item => this.append(item, distElement));
3460
+ append(elms, distElementOrIndex) {
3461
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isArray)(elms)) {
3462
+ if (typeof distElementOrIndex === 'number') {
3463
+ throw new Error('You can not use index when append array of elements');
3464
+ }
3465
+ elms.forEach(item => this.append(item, distElementOrIndex));
3469
3466
  return this;
3470
3467
  }
3471
- this.elements.push(elm);
3468
+ const elm = elms;
3469
+ let index = undefined;
3470
+ if (typeof distElementOrIndex === 'number') {
3471
+ index = Math.min(Math.max(0, distElementOrIndex), this.elements.length);
3472
+ this.elements.splice(index, 0, elm);
3473
+ }
3474
+ else {
3475
+ this.elements.push(elm);
3476
+ }
3472
3477
  if (elm.name) {
3473
3478
  elm.container.classList.add(this.getFullElName(elm.name));
3474
3479
  }
3475
- if (distElement) {
3476
- const distElm = this.getElm(distElement);
3477
- void 0;
3480
+ if (distElementOrIndex && typeof distElementOrIndex === 'string') {
3481
+ const distElm = this.getElm(distElementOrIndex);
3482
+ if (distElm == null) {
3483
+ throw new Error('Element does not exist');
3484
+ }
3478
3485
  distElm.appendChild(elm.container);
3479
3486
  }
3480
3487
  else {
3481
- this.appendChildToContainer(elm.container);
3488
+ this.appendChildToContainer(elm.container, index);
3482
3489
  }
3483
3490
  elm.parentElement = this;
3484
3491
  return this;
@@ -3492,8 +3499,16 @@ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_I
3492
3499
  /**
3493
3500
  * Allow set another container for the box of all children
3494
3501
  */
3495
- appendChildToContainer(childContainer) {
3496
- this.container.appendChild(childContainer);
3502
+ appendChildToContainer(childContainer, index) {
3503
+ if (index === undefined ||
3504
+ index < 0 ||
3505
+ index > this.elements.length - 1 ||
3506
+ this.container.children[index] == null) {
3507
+ this.container.appendChild(childContainer);
3508
+ }
3509
+ else {
3510
+ this.container.insertBefore(childContainer, this.container.children[index]);
3511
+ }
3497
3512
  }
3498
3513
  /**
3499
3514
  * Remove element from group
@@ -8333,7 +8348,7 @@ __webpack_require__.r(__webpack_exports__);
8333
8348
  * Released under MIT see LICENSE.txt in the project root for license information.
8334
8349
  * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
8335
8350
  */
8336
- const APP_VERSION = "4.6.6";
8351
+ const APP_VERSION = "4.6.11";
8337
8352
  // prettier-ignore
8338
8353
  const ES = "es2021";
8339
8354
  const IS_ES_MODERN = true;
@@ -13939,13 +13954,16 @@ function observable(obj) {
13939
13954
 
13940
13955
  "use strict";
13941
13956
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13942
- /* harmony export */ $r: function() { return /* reexport safe */ _to_array__WEBPACK_IMPORTED_MODULE_2__.$; },
13957
+ /* harmony export */ $r: function() { return /* reexport safe */ _to_array__WEBPACK_IMPORTED_MODULE_3__.$; },
13943
13958
  /* harmony export */ _j: function() { return /* reexport safe */ _as_array__WEBPACK_IMPORTED_MODULE_0__._; },
13944
- /* harmony export */ uM: function() { return /* reexport safe */ _split_array__WEBPACK_IMPORTED_MODULE_1__.u; }
13959
+ /* harmony export */ ft: function() { return /* reexport safe */ _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__.f; },
13960
+ /* harmony export */ j5: function() { return /* reexport safe */ _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__.j; },
13961
+ /* harmony export */ uM: function() { return /* reexport safe */ _split_array__WEBPACK_IMPORTED_MODULE_2__.u; }
13945
13962
  /* harmony export */ });
13946
13963
  /* harmony import */ var _as_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82317);
13947
- /* harmony import */ var _split_array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(42589);
13948
- /* harmony import */ var _to_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42448);
13964
+ /* harmony import */ var _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(63784);
13965
+ /* harmony import */ var _split_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42589);
13966
+ /* harmony import */ var _to_array__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42448);
13949
13967
  /*!
13950
13968
  * Jodit Editor (https://xdsoft.net/jodit/)
13951
13969
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -13959,6 +13977,7 @@ function observable(obj) {
13959
13977
 
13960
13978
 
13961
13979
 
13980
+
13962
13981
  /***/ }),
13963
13982
 
13964
13983
  /***/ 32782:
@@ -29053,6 +29072,121 @@ function moveCursorOutFromSpecialTags(jodit, fake, tags) {
29053
29072
  }
29054
29073
 
29055
29074
 
29075
+ /***/ }),
29076
+
29077
+ /***/ 63784:
29078
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
29079
+
29080
+ "use strict";
29081
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
29082
+ /* harmony export */ f: function() { return /* binding */ applyArrayReconciliation; },
29083
+ /* harmony export */ j: function() { return /* binding */ reconcileArrays; }
29084
+ /* harmony export */ });
29085
+ /*!
29086
+ * Jodit Editor (https://xdsoft.net/jodit/)
29087
+ * Released under MIT see LICENSE.txt in the project root for license information.
29088
+ * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
29089
+ */
29090
+ /**
29091
+ * Reconciles two arrays and returns the differences
29092
+ * @param oldArray - The original array
29093
+ * @param newArray - The new array to compare against
29094
+ * @param keyFn - Optional function to generate unique keys for items (for object comparison)
29095
+ * @returns Object containing added, removed, kept and moved items
29096
+ *
29097
+ * @example
29098
+ * ```typescript
29099
+ * const old = [1, 2, 3, 4];
29100
+ * const new = [2, 4, 5, 1];
29101
+ * const result = reconcileArrays(old, new);
29102
+ * // result.added = [5]
29103
+ * // result.removed = [3]
29104
+ * // result.kept = [2, 4, 1]
29105
+ * // result.moved = [{item: 1, from: 0, to: 3}]
29106
+ * ```
29107
+ *
29108
+ * @example
29109
+ * ```typescript
29110
+ * const old = [{id: 1, name: 'a'}, {id: 2, name: 'b'}];
29111
+ * const new = [{id: 2, name: 'b'}, {id: 3, name: 'c'}];
29112
+ * const result = reconcileArrays(old, new, item => item.id);
29113
+ * // result.added = [{id: 3, name: 'c'}]
29114
+ * // result.removed = [{id: 1, name: 'a'}]
29115
+ * ```
29116
+ */
29117
+ function reconcileArrays(oldArray, newArray, keyFn) {
29118
+ const getKey = keyFn || ((item) => item);
29119
+ const oldMap = new Map();
29120
+ const newMap = new Map();
29121
+ oldArray.forEach((item, index) => {
29122
+ oldMap.set(getKey(item), { item, index });
29123
+ });
29124
+ newArray.forEach((item, index) => {
29125
+ newMap.set(getKey(item), { item, index });
29126
+ });
29127
+ const added = [];
29128
+ const removed = [];
29129
+ const kept = [];
29130
+ const moved = [];
29131
+ // Find removed items
29132
+ oldMap.forEach((value, key) => {
29133
+ if (!newMap.has(key)) {
29134
+ removed.push(value.item);
29135
+ }
29136
+ });
29137
+ // Find added items and track kept/moved items
29138
+ newMap.forEach((value, key) => {
29139
+ const oldItem = oldMap.get(key);
29140
+ if (!oldItem) {
29141
+ added.push(value.item);
29142
+ }
29143
+ else {
29144
+ kept.push(value.item);
29145
+ if (oldItem.index !== value.index) {
29146
+ moved.push({
29147
+ item: value.item,
29148
+ from: oldItem.index,
29149
+ to: value.index
29150
+ });
29151
+ }
29152
+ }
29153
+ });
29154
+ return {
29155
+ added,
29156
+ removed,
29157
+ kept,
29158
+ moved
29159
+ };
29160
+ }
29161
+ /**
29162
+ * Applies reconciliation patches to transform one array into another
29163
+ * @param oldArray - The original array to transform
29164
+ * @param newArray - The target array structure
29165
+ * @param keyFn - Optional function to generate unique keys for items
29166
+ * @returns New array matching the structure of newArray
29167
+ */
29168
+ function applyArrayReconciliation(oldArray, newArray, keyFn) {
29169
+ const result = reconcileArrays(oldArray, newArray, keyFn);
29170
+ const output = [];
29171
+ // Build the new array based on newArray order
29172
+ newArray.forEach(item => {
29173
+ const key = keyFn ? keyFn(item) : item;
29174
+ const isNew = result.added.some(addedItem => (keyFn ? keyFn(addedItem) : addedItem) === key);
29175
+ if (isNew) {
29176
+ output.push(item);
29177
+ }
29178
+ else {
29179
+ // Use the old item reference if it exists
29180
+ const oldItem = oldArray.find(oldItem => (keyFn ? keyFn(oldItem) : oldItem) === key);
29181
+ if (oldItem !== undefined) {
29182
+ output.push(oldItem);
29183
+ }
29184
+ }
29185
+ });
29186
+ return output;
29187
+ }
29188
+
29189
+
29056
29190
  /***/ }),
29057
29191
 
29058
29192
  /***/ 63837:
@@ -29620,6 +29754,7 @@ __webpack_require__.r(__webpack_exports__);
29620
29754
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
29621
29755
  /* harmony export */ CamelCaseToKebabCase: function() { return /* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_7__.N; },
29622
29756
  /* harmony export */ NUMBER_FIELDS_REG: function() { return /* reexport safe */ _normalize__WEBPACK_IMPORTED_MODULE_5__.b$; },
29757
+ /* harmony export */ applyArrayReconciliation: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__.ft; },
29623
29758
  /* harmony export */ applyStyles: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.ZM; },
29624
29759
  /* harmony export */ asArray: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__._j; },
29625
29760
  /* harmony export */ camelCase: function() { return /* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_7__.xQ; },
@@ -29674,6 +29809,7 @@ __webpack_require__.r(__webpack_exports__);
29674
29809
  /* harmony export */ normalizeUrl: function() { return /* reexport safe */ _normalize__WEBPACK_IMPORTED_MODULE_5__.l2; },
29675
29810
  /* harmony export */ offset: function() { return /* reexport safe */ _size__WEBPACK_IMPORTED_MODULE_6__.cY; },
29676
29811
  /* harmony export */ position: function() { return /* reexport safe */ _size__WEBPACK_IMPORTED_MODULE_6__.G1; },
29812
+ /* harmony export */ reconcileArrays: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__.j5; },
29677
29813
  /* harmony export */ safeHTML: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.t_; },
29678
29814
  /* harmony export */ sanitizeHTMLElement: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.vn; },
29679
29815
  /* harmony export */ setTimeout: function() { return /* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_1__.w; },
@@ -29698,7 +29834,7 @@ __webpack_require__.r(__webpack_exports__);
29698
29834
  /* harmony import */ var _string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6589);
29699
29835
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(97369);
29700
29836
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
29701
- /* 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__)
29837
+ /* 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__)
29702
29838
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
29703
29839
  /*!
29704
29840
  * Jodit Editor (https://xdsoft.net/jodit/)