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/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.6.6
4
+ * Version: v4.6.11
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -3409,9 +3409,7 @@ function brBefore(start) {
3409
3409
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22664);
3410
3410
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(55186);
3411
3411
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65147);
3412
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28712);
3413
- /* 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__);
3414
- /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(29780);
3412
+ /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29780);
3415
3413
  /*!
3416
3414
  * Jodit Editor (https://xdsoft.net/jodit/)
3417
3415
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -3425,8 +3423,7 @@ var UIGroup_1;
3425
3423
 
3426
3424
 
3427
3425
 
3428
-
3429
- let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_6__/* .UIElement */ .D {
3426
+ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_5__/* .UIElement */ .D {
3430
3427
  className() {
3431
3428
  return 'UIGroup';
3432
3429
  }
@@ -3459,25 +3456,35 @@ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_I
3459
3456
  this.elements.forEach(elm => elm.update());
3460
3457
  this.setMod('size', this.buttonSize);
3461
3458
  }
3462
- /**
3463
- * Append new element into group
3464
- */
3465
- append(elm, distElement) {
3466
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isArray)(elm)) {
3467
- elm.forEach(item => this.append(item, distElement));
3459
+ append(elms, distElementOrIndex) {
3460
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isArray)(elms)) {
3461
+ if (typeof distElementOrIndex === 'number') {
3462
+ throw new Error('You can not use index when append array of elements');
3463
+ }
3464
+ elms.forEach(item => this.append(item, distElementOrIndex));
3468
3465
  return this;
3469
3466
  }
3470
- this.elements.push(elm);
3467
+ const elm = elms;
3468
+ let index = undefined;
3469
+ if (typeof distElementOrIndex === 'number') {
3470
+ index = Math.min(Math.max(0, distElementOrIndex), this.elements.length);
3471
+ this.elements.splice(index, 0, elm);
3472
+ }
3473
+ else {
3474
+ this.elements.push(elm);
3475
+ }
3471
3476
  if (elm.name) {
3472
3477
  elm.container.classList.add(this.getFullElName(elm.name));
3473
3478
  }
3474
- if (distElement) {
3475
- const distElm = this.getElm(distElement);
3476
- void 0;
3479
+ if (distElementOrIndex && typeof distElementOrIndex === 'string') {
3480
+ const distElm = this.getElm(distElementOrIndex);
3481
+ if (distElm == null) {
3482
+ throw new Error('Element does not exist');
3483
+ }
3477
3484
  distElm.appendChild(elm.container);
3478
3485
  }
3479
3486
  else {
3480
- this.appendChildToContainer(elm.container);
3487
+ this.appendChildToContainer(elm.container, index);
3481
3488
  }
3482
3489
  elm.parentElement = this;
3483
3490
  return this;
@@ -3491,8 +3498,16 @@ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_I
3491
3498
  /**
3492
3499
  * Allow set another container for the box of all children
3493
3500
  */
3494
- appendChildToContainer(childContainer) {
3495
- this.container.appendChild(childContainer);
3501
+ appendChildToContainer(childContainer, index) {
3502
+ if (index === undefined ||
3503
+ index < 0 ||
3504
+ index > this.elements.length - 1 ||
3505
+ this.container.children[index] == null) {
3506
+ this.container.appendChild(childContainer);
3507
+ }
3508
+ else {
3509
+ this.container.insertBefore(childContainer, this.container.children[index]);
3510
+ }
3496
3511
  }
3497
3512
  /**
3498
3513
  * Remove element from group
@@ -8364,7 +8379,7 @@ __webpack_require__.r(__webpack_exports__);
8364
8379
  * Released under MIT see LICENSE.txt in the project root for license information.
8365
8380
  * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
8366
8381
  */
8367
- const APP_VERSION = "4.6.6";
8382
+ const APP_VERSION = "4.6.11";
8368
8383
  // prettier-ignore
8369
8384
  const ES = "es2015";
8370
8385
  const IS_ES_MODERN = true;
@@ -13999,13 +14014,16 @@ function observable(obj) {
13999
14014
 
14000
14015
  "use strict";
14001
14016
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
14002
- /* harmony export */ $r: function() { return /* reexport safe */ _to_array__WEBPACK_IMPORTED_MODULE_2__.$; },
14017
+ /* harmony export */ $r: function() { return /* reexport safe */ _to_array__WEBPACK_IMPORTED_MODULE_3__.$; },
14003
14018
  /* harmony export */ _j: function() { return /* reexport safe */ _as_array__WEBPACK_IMPORTED_MODULE_0__._; },
14004
- /* harmony export */ uM: function() { return /* reexport safe */ _split_array__WEBPACK_IMPORTED_MODULE_1__.u; }
14019
+ /* harmony export */ ft: function() { return /* reexport safe */ _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__.f; },
14020
+ /* harmony export */ j5: function() { return /* reexport safe */ _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__.j; },
14021
+ /* harmony export */ uM: function() { return /* reexport safe */ _split_array__WEBPACK_IMPORTED_MODULE_2__.u; }
14005
14022
  /* harmony export */ });
14006
14023
  /* harmony import */ var _as_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82317);
14007
- /* harmony import */ var _split_array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(42589);
14008
- /* harmony import */ var _to_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42448);
14024
+ /* harmony import */ var _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(63784);
14025
+ /* harmony import */ var _split_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42589);
14026
+ /* harmony import */ var _to_array__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42448);
14009
14027
  /*!
14010
14028
  * Jodit Editor (https://xdsoft.net/jodit/)
14011
14029
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -14019,6 +14037,7 @@ function observable(obj) {
14019
14037
 
14020
14038
 
14021
14039
 
14040
+
14022
14041
  /***/ }),
14023
14042
 
14024
14043
  /***/ 32782:
@@ -29086,6 +29105,121 @@ function moveCursorOutFromSpecialTags(jodit, fake, tags) {
29086
29105
  }
29087
29106
 
29088
29107
 
29108
+ /***/ }),
29109
+
29110
+ /***/ 63784:
29111
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
29112
+
29113
+ "use strict";
29114
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
29115
+ /* harmony export */ f: function() { return /* binding */ applyArrayReconciliation; },
29116
+ /* harmony export */ j: function() { return /* binding */ reconcileArrays; }
29117
+ /* harmony export */ });
29118
+ /*!
29119
+ * Jodit Editor (https://xdsoft.net/jodit/)
29120
+ * Released under MIT see LICENSE.txt in the project root for license information.
29121
+ * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
29122
+ */
29123
+ /**
29124
+ * Reconciles two arrays and returns the differences
29125
+ * @param oldArray - The original array
29126
+ * @param newArray - The new array to compare against
29127
+ * @param keyFn - Optional function to generate unique keys for items (for object comparison)
29128
+ * @returns Object containing added, removed, kept and moved items
29129
+ *
29130
+ * @example
29131
+ * ```typescript
29132
+ * const old = [1, 2, 3, 4];
29133
+ * const new = [2, 4, 5, 1];
29134
+ * const result = reconcileArrays(old, new);
29135
+ * // result.added = [5]
29136
+ * // result.removed = [3]
29137
+ * // result.kept = [2, 4, 1]
29138
+ * // result.moved = [{item: 1, from: 0, to: 3}]
29139
+ * ```
29140
+ *
29141
+ * @example
29142
+ * ```typescript
29143
+ * const old = [{id: 1, name: 'a'}, {id: 2, name: 'b'}];
29144
+ * const new = [{id: 2, name: 'b'}, {id: 3, name: 'c'}];
29145
+ * const result = reconcileArrays(old, new, item => item.id);
29146
+ * // result.added = [{id: 3, name: 'c'}]
29147
+ * // result.removed = [{id: 1, name: 'a'}]
29148
+ * ```
29149
+ */
29150
+ function reconcileArrays(oldArray, newArray, keyFn) {
29151
+ const getKey = keyFn || ((item) => item);
29152
+ const oldMap = new Map();
29153
+ const newMap = new Map();
29154
+ oldArray.forEach((item, index) => {
29155
+ oldMap.set(getKey(item), { item, index });
29156
+ });
29157
+ newArray.forEach((item, index) => {
29158
+ newMap.set(getKey(item), { item, index });
29159
+ });
29160
+ const added = [];
29161
+ const removed = [];
29162
+ const kept = [];
29163
+ const moved = [];
29164
+ // Find removed items
29165
+ oldMap.forEach((value, key) => {
29166
+ if (!newMap.has(key)) {
29167
+ removed.push(value.item);
29168
+ }
29169
+ });
29170
+ // Find added items and track kept/moved items
29171
+ newMap.forEach((value, key) => {
29172
+ const oldItem = oldMap.get(key);
29173
+ if (!oldItem) {
29174
+ added.push(value.item);
29175
+ }
29176
+ else {
29177
+ kept.push(value.item);
29178
+ if (oldItem.index !== value.index) {
29179
+ moved.push({
29180
+ item: value.item,
29181
+ from: oldItem.index,
29182
+ to: value.index
29183
+ });
29184
+ }
29185
+ }
29186
+ });
29187
+ return {
29188
+ added,
29189
+ removed,
29190
+ kept,
29191
+ moved
29192
+ };
29193
+ }
29194
+ /**
29195
+ * Applies reconciliation patches to transform one array into another
29196
+ * @param oldArray - The original array to transform
29197
+ * @param newArray - The target array structure
29198
+ * @param keyFn - Optional function to generate unique keys for items
29199
+ * @returns New array matching the structure of newArray
29200
+ */
29201
+ function applyArrayReconciliation(oldArray, newArray, keyFn) {
29202
+ const result = reconcileArrays(oldArray, newArray, keyFn);
29203
+ const output = [];
29204
+ // Build the new array based on newArray order
29205
+ newArray.forEach(item => {
29206
+ const key = keyFn ? keyFn(item) : item;
29207
+ const isNew = result.added.some(addedItem => (keyFn ? keyFn(addedItem) : addedItem) === key);
29208
+ if (isNew) {
29209
+ output.push(item);
29210
+ }
29211
+ else {
29212
+ // Use the old item reference if it exists
29213
+ const oldItem = oldArray.find(oldItem => (keyFn ? keyFn(oldItem) : oldItem) === key);
29214
+ if (oldItem !== undefined) {
29215
+ output.push(oldItem);
29216
+ }
29217
+ }
29218
+ });
29219
+ return output;
29220
+ }
29221
+
29222
+
29089
29223
  /***/ }),
29090
29224
 
29091
29225
  /***/ 63837:
@@ -29654,6 +29788,7 @@ __webpack_require__.r(__webpack_exports__);
29654
29788
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
29655
29789
  /* harmony export */ CamelCaseToKebabCase: function() { return /* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_7__.N; },
29656
29790
  /* harmony export */ NUMBER_FIELDS_REG: function() { return /* reexport safe */ _normalize__WEBPACK_IMPORTED_MODULE_5__.b$; },
29791
+ /* harmony export */ applyArrayReconciliation: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__.ft; },
29657
29792
  /* harmony export */ applyStyles: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.ZM; },
29658
29793
  /* harmony export */ asArray: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__._j; },
29659
29794
  /* harmony export */ camelCase: function() { return /* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_7__.xQ; },
@@ -29708,6 +29843,7 @@ __webpack_require__.r(__webpack_exports__);
29708
29843
  /* harmony export */ normalizeUrl: function() { return /* reexport safe */ _normalize__WEBPACK_IMPORTED_MODULE_5__.l2; },
29709
29844
  /* harmony export */ offset: function() { return /* reexport safe */ _size__WEBPACK_IMPORTED_MODULE_6__.cY; },
29710
29845
  /* harmony export */ position: function() { return /* reexport safe */ _size__WEBPACK_IMPORTED_MODULE_6__.G1; },
29846
+ /* harmony export */ reconcileArrays: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__.j5; },
29711
29847
  /* harmony export */ safeHTML: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.t_; },
29712
29848
  /* harmony export */ sanitizeHTMLElement: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.vn; },
29713
29849
  /* harmony export */ setTimeout: function() { return /* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_1__.w; },
@@ -29732,7 +29868,7 @@ __webpack_require__.r(__webpack_exports__);
29732
29868
  /* harmony import */ var _string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6589);
29733
29869
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(97369);
29734
29870
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
29735
- /* 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__)
29871
+ /* 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__)
29736
29872
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
29737
29873
  /*!
29738
29874
  * Jodit Editor (https://xdsoft.net/jodit/)