jodit 4.6.6 → 4.6.10

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
@@ -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.10
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -3294,9 +3294,7 @@ function brBefore(start) {
3294
3294
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22664);
3295
3295
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(55186);
3296
3296
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65147);
3297
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28712);
3298
- /* 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__);
3299
- /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(29780);
3297
+ /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29780);
3300
3298
  /*!
3301
3299
  * Jodit Editor (https://xdsoft.net/jodit/)
3302
3300
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -3310,8 +3308,7 @@ var UIGroup_1;
3310
3308
 
3311
3309
 
3312
3310
 
3313
-
3314
- let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_6__/* .UIElement */ .D {
3311
+ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_5__/* .UIElement */ .D {
3315
3312
  className() {
3316
3313
  return 'UIGroup';
3317
3314
  }
@@ -3344,25 +3341,35 @@ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_I
3344
3341
  this.elements.forEach(elm => elm.update());
3345
3342
  this.setMod('size', this.buttonSize);
3346
3343
  }
3347
- /**
3348
- * Append new element into group
3349
- */
3350
- append(elm, distElement) {
3351
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isArray)(elm)) {
3352
- elm.forEach(item => this.append(item, distElement));
3344
+ append(elms, distElementOrIndex) {
3345
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isArray)(elms)) {
3346
+ if (typeof distElementOrIndex === 'number') {
3347
+ throw new Error('You can not use index when append array of elements');
3348
+ }
3349
+ elms.forEach(item => this.append(item, distElementOrIndex));
3353
3350
  return this;
3354
3351
  }
3355
- this.elements.push(elm);
3352
+ const elm = elms;
3353
+ let index = undefined;
3354
+ if (typeof distElementOrIndex === 'number') {
3355
+ index = Math.min(Math.max(0, distElementOrIndex), this.elements.length);
3356
+ this.elements.splice(index, 0, elm);
3357
+ }
3358
+ else {
3359
+ this.elements.push(elm);
3360
+ }
3356
3361
  if (elm.name) {
3357
3362
  elm.container.classList.add(this.getFullElName(elm.name));
3358
3363
  }
3359
- if (distElement) {
3360
- const distElm = this.getElm(distElement);
3361
- void 0;
3364
+ if (distElementOrIndex && typeof distElementOrIndex === 'string') {
3365
+ const distElm = this.getElm(distElementOrIndex);
3366
+ if (distElm == null) {
3367
+ throw new Error('Element does not exist');
3368
+ }
3362
3369
  distElm.appendChild(elm.container);
3363
3370
  }
3364
3371
  else {
3365
- this.appendChildToContainer(elm.container);
3372
+ this.appendChildToContainer(elm.container, index);
3366
3373
  }
3367
3374
  elm.parentElement = this;
3368
3375
  return this;
@@ -3376,8 +3383,16 @@ let UIGroup = UIGroup_1 = class UIGroup extends jodit_core_ui_element__WEBPACK_I
3376
3383
  /**
3377
3384
  * Allow set another container for the box of all children
3378
3385
  */
3379
- appendChildToContainer(childContainer) {
3380
- this.container.appendChild(childContainer);
3386
+ appendChildToContainer(childContainer, index) {
3387
+ if (index === undefined ||
3388
+ index < 0 ||
3389
+ index > this.elements.length - 1 ||
3390
+ this.container.children[index] == null) {
3391
+ this.container.appendChild(childContainer);
3392
+ }
3393
+ else {
3394
+ this.container.insertBefore(childContainer, this.container.children[index]);
3395
+ }
3381
3396
  }
3382
3397
  /**
3383
3398
  * Remove element from group
@@ -7945,7 +7960,7 @@ __webpack_require__.r(__webpack_exports__);
7945
7960
  * Released under MIT see LICENSE.txt in the project root for license information.
7946
7961
  * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
7947
7962
  */
7948
- const APP_VERSION = "4.6.6";
7963
+ const APP_VERSION = "4.6.10";
7949
7964
  // prettier-ignore
7950
7965
  const ES = "es2021";
7951
7966
  const IS_ES_MODERN = true;
@@ -13346,13 +13361,16 @@ function observable(obj) {
13346
13361
 
13347
13362
  "use strict";
13348
13363
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13349
- /* harmony export */ $r: function() { return /* reexport safe */ _to_array__WEBPACK_IMPORTED_MODULE_2__.$; },
13364
+ /* harmony export */ $r: function() { return /* reexport safe */ _to_array__WEBPACK_IMPORTED_MODULE_3__.$; },
13350
13365
  /* harmony export */ _j: function() { return /* reexport safe */ _as_array__WEBPACK_IMPORTED_MODULE_0__._; },
13351
- /* harmony export */ uM: function() { return /* reexport safe */ _split_array__WEBPACK_IMPORTED_MODULE_1__.u; }
13366
+ /* harmony export */ ft: function() { return /* reexport safe */ _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__.f; },
13367
+ /* harmony export */ j5: function() { return /* reexport safe */ _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__.j; },
13368
+ /* harmony export */ uM: function() { return /* reexport safe */ _split_array__WEBPACK_IMPORTED_MODULE_2__.u; }
13352
13369
  /* harmony export */ });
13353
13370
  /* harmony import */ var _as_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82317);
13354
- /* harmony import */ var _split_array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(42589);
13355
- /* harmony import */ var _to_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42448);
13371
+ /* harmony import */ var _reconcile_arrays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(63784);
13372
+ /* harmony import */ var _split_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42589);
13373
+ /* harmony import */ var _to_array__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42448);
13356
13374
  /*!
13357
13375
  * Jodit Editor (https://xdsoft.net/jodit/)
13358
13376
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -13366,6 +13384,7 @@ function observable(obj) {
13366
13384
 
13367
13385
 
13368
13386
 
13387
+
13369
13388
  /***/ }),
13370
13389
 
13371
13390
  /***/ 32782:
@@ -27952,6 +27971,121 @@ function moveCursorOutFromSpecialTags(jodit, fake, tags) {
27952
27971
  }
27953
27972
 
27954
27973
 
27974
+ /***/ }),
27975
+
27976
+ /***/ 63784:
27977
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
27978
+
27979
+ "use strict";
27980
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27981
+ /* harmony export */ f: function() { return /* binding */ applyArrayReconciliation; },
27982
+ /* harmony export */ j: function() { return /* binding */ reconcileArrays; }
27983
+ /* harmony export */ });
27984
+ /*!
27985
+ * Jodit Editor (https://xdsoft.net/jodit/)
27986
+ * Released under MIT see LICENSE.txt in the project root for license information.
27987
+ * Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
27988
+ */
27989
+ /**
27990
+ * Reconciles two arrays and returns the differences
27991
+ * @param oldArray - The original array
27992
+ * @param newArray - The new array to compare against
27993
+ * @param keyFn - Optional function to generate unique keys for items (for object comparison)
27994
+ * @returns Object containing added, removed, kept and moved items
27995
+ *
27996
+ * @example
27997
+ * ```typescript
27998
+ * const old = [1, 2, 3, 4];
27999
+ * const new = [2, 4, 5, 1];
28000
+ * const result = reconcileArrays(old, new);
28001
+ * // result.added = [5]
28002
+ * // result.removed = [3]
28003
+ * // result.kept = [2, 4, 1]
28004
+ * // result.moved = [{item: 1, from: 0, to: 3}]
28005
+ * ```
28006
+ *
28007
+ * @example
28008
+ * ```typescript
28009
+ * const old = [{id: 1, name: 'a'}, {id: 2, name: 'b'}];
28010
+ * const new = [{id: 2, name: 'b'}, {id: 3, name: 'c'}];
28011
+ * const result = reconcileArrays(old, new, item => item.id);
28012
+ * // result.added = [{id: 3, name: 'c'}]
28013
+ * // result.removed = [{id: 1, name: 'a'}]
28014
+ * ```
28015
+ */
28016
+ function reconcileArrays(oldArray, newArray, keyFn) {
28017
+ const getKey = keyFn || ((item) => item);
28018
+ const oldMap = new Map();
28019
+ const newMap = new Map();
28020
+ oldArray.forEach((item, index) => {
28021
+ oldMap.set(getKey(item), { item, index });
28022
+ });
28023
+ newArray.forEach((item, index) => {
28024
+ newMap.set(getKey(item), { item, index });
28025
+ });
28026
+ const added = [];
28027
+ const removed = [];
28028
+ const kept = [];
28029
+ const moved = [];
28030
+ // Find removed items
28031
+ oldMap.forEach((value, key) => {
28032
+ if (!newMap.has(key)) {
28033
+ removed.push(value.item);
28034
+ }
28035
+ });
28036
+ // Find added items and track kept/moved items
28037
+ newMap.forEach((value, key) => {
28038
+ const oldItem = oldMap.get(key);
28039
+ if (!oldItem) {
28040
+ added.push(value.item);
28041
+ }
28042
+ else {
28043
+ kept.push(value.item);
28044
+ if (oldItem.index !== value.index) {
28045
+ moved.push({
28046
+ item: value.item,
28047
+ from: oldItem.index,
28048
+ to: value.index
28049
+ });
28050
+ }
28051
+ }
28052
+ });
28053
+ return {
28054
+ added,
28055
+ removed,
28056
+ kept,
28057
+ moved
28058
+ };
28059
+ }
28060
+ /**
28061
+ * Applies reconciliation patches to transform one array into another
28062
+ * @param oldArray - The original array to transform
28063
+ * @param newArray - The target array structure
28064
+ * @param keyFn - Optional function to generate unique keys for items
28065
+ * @returns New array matching the structure of newArray
28066
+ */
28067
+ function applyArrayReconciliation(oldArray, newArray, keyFn) {
28068
+ const result = reconcileArrays(oldArray, newArray, keyFn);
28069
+ const output = [];
28070
+ // Build the new array based on newArray order
28071
+ newArray.forEach(item => {
28072
+ const key = keyFn ? keyFn(item) : item;
28073
+ const isNew = result.added.some(addedItem => (keyFn ? keyFn(addedItem) : addedItem) === key);
28074
+ if (isNew) {
28075
+ output.push(item);
28076
+ }
28077
+ else {
28078
+ // Use the old item reference if it exists
28079
+ const oldItem = oldArray.find(oldItem => (keyFn ? keyFn(oldItem) : oldItem) === key);
28080
+ if (oldItem !== undefined) {
28081
+ output.push(oldItem);
28082
+ }
28083
+ }
28084
+ });
28085
+ return output;
28086
+ }
28087
+
28088
+
27955
28089
  /***/ }),
27956
28090
 
27957
28091
  /***/ 63837:
@@ -28468,6 +28602,7 @@ __webpack_require__.r(__webpack_exports__);
28468
28602
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
28469
28603
  /* harmony export */ CamelCaseToKebabCase: function() { return /* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_7__.N; },
28470
28604
  /* harmony export */ NUMBER_FIELDS_REG: function() { return /* reexport safe */ _normalize__WEBPACK_IMPORTED_MODULE_5__.b$; },
28605
+ /* harmony export */ applyArrayReconciliation: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__.ft; },
28471
28606
  /* harmony export */ applyStyles: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.ZM; },
28472
28607
  /* harmony export */ asArray: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__._j; },
28473
28608
  /* harmony export */ camelCase: function() { return /* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_7__.xQ; },
@@ -28522,6 +28657,7 @@ __webpack_require__.r(__webpack_exports__);
28522
28657
  /* harmony export */ normalizeUrl: function() { return /* reexport safe */ _normalize__WEBPACK_IMPORTED_MODULE_5__.l2; },
28523
28658
  /* harmony export */ offset: function() { return /* reexport safe */ _size__WEBPACK_IMPORTED_MODULE_6__.cY; },
28524
28659
  /* harmony export */ position: function() { return /* reexport safe */ _size__WEBPACK_IMPORTED_MODULE_6__.G1; },
28660
+ /* harmony export */ reconcileArrays: function() { return /* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_0__.j5; },
28525
28661
  /* harmony export */ safeHTML: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.t_; },
28526
28662
  /* harmony export */ sanitizeHTMLElement: function() { return /* reexport safe */ _html__WEBPACK_IMPORTED_MODULE_4__.vn; },
28527
28663
  /* harmony export */ setTimeout: function() { return /* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_1__.w; },
@@ -28546,7 +28682,7 @@ __webpack_require__.r(__webpack_exports__);
28546
28682
  /* harmony import */ var _string__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6589);
28547
28683
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(97369);
28548
28684
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
28549
- /* 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__)
28685
+ /* 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__)
28550
28686
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
28551
28687
  /*!
28552
28688
  * Jodit Editor (https://xdsoft.net/jodit/)