jodit 4.6.10 → 4.6.12
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.
- package/CHANGELOG.md +6 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +7 -128
- package/es2015/jodit.min.js +2 -2
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +7 -128
- package/es2018/jodit.min.js +2 -2
- package/es2018/plugins/debug/debug.css +1 -1
- package/es2018/plugins/debug/debug.js +1 -1
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +7 -128
- package/es2021/jodit.min.js +2 -2
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +7 -128
- package/es2021.en/jodit.min.js +2 -2
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/415.fat.min.js +1 -1
- package/es5/415.min.js +1 -1
- package/es5/5.fat.min.js +1 -1
- package/es5/5.min.js +1 -1
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +7 -128
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/array/index.d.ts +0 -1
- package/esm/core/helpers/array/index.js +0 -1
- package/package.json +1 -1
- package/types/core/helpers/array/index.d.ts +0 -1
- package/esm/core/helpers/array/reconcile-arrays.d.ts +0 -54
- package/esm/core/helpers/array/reconcile-arrays.js +0 -103
- package/types/core/helpers/array/reconcile-arrays.d.ts +0 -54
package/esm/core/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.6.
|
|
6
|
+
export const APP_VERSION = "4.6.12";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
package/package.json
CHANGED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @module helpers/array
|
|
8
|
-
*/
|
|
9
|
-
export interface ReconcileResult<T> {
|
|
10
|
-
added: T[];
|
|
11
|
-
removed: T[];
|
|
12
|
-
kept: T[];
|
|
13
|
-
moved: Array<{
|
|
14
|
-
item: T;
|
|
15
|
-
from: number;
|
|
16
|
-
to: number;
|
|
17
|
-
}>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Reconciles two arrays and returns the differences
|
|
21
|
-
* @param oldArray - The original array
|
|
22
|
-
* @param newArray - The new array to compare against
|
|
23
|
-
* @param keyFn - Optional function to generate unique keys for items (for object comparison)
|
|
24
|
-
* @returns Object containing added, removed, kept and moved items
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* const old = [1, 2, 3, 4];
|
|
29
|
-
* const new = [2, 4, 5, 1];
|
|
30
|
-
* const result = reconcileArrays(old, new);
|
|
31
|
-
* // result.added = [5]
|
|
32
|
-
* // result.removed = [3]
|
|
33
|
-
* // result.kept = [2, 4, 1]
|
|
34
|
-
* // result.moved = [{item: 1, from: 0, to: 3}]
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```typescript
|
|
39
|
-
* const old = [{id: 1, name: 'a'}, {id: 2, name: 'b'}];
|
|
40
|
-
* const new = [{id: 2, name: 'b'}, {id: 3, name: 'c'}];
|
|
41
|
-
* const result = reconcileArrays(old, new, item => item.id);
|
|
42
|
-
* // result.added = [{id: 3, name: 'c'}]
|
|
43
|
-
* // result.removed = [{id: 1, name: 'a'}]
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function reconcileArrays<T>(oldArray: T[], newArray: T[], keyFn?: (item: T) => string | number): ReconcileResult<T>;
|
|
47
|
-
/**
|
|
48
|
-
* Applies reconciliation patches to transform one array into another
|
|
49
|
-
* @param oldArray - The original array to transform
|
|
50
|
-
* @param newArray - The target array structure
|
|
51
|
-
* @param keyFn - Optional function to generate unique keys for items
|
|
52
|
-
* @returns New array matching the structure of newArray
|
|
53
|
-
*/
|
|
54
|
-
export declare function applyArrayReconciliation<T>(oldArray: T[], newArray: T[], keyFn?: (item: T) => string | number): T[];
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Reconciles two arrays and returns the differences
|
|
8
|
-
* @param oldArray - The original array
|
|
9
|
-
* @param newArray - The new array to compare against
|
|
10
|
-
* @param keyFn - Optional function to generate unique keys for items (for object comparison)
|
|
11
|
-
* @returns Object containing added, removed, kept and moved items
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const old = [1, 2, 3, 4];
|
|
16
|
-
* const new = [2, 4, 5, 1];
|
|
17
|
-
* const result = reconcileArrays(old, new);
|
|
18
|
-
* // result.added = [5]
|
|
19
|
-
* // result.removed = [3]
|
|
20
|
-
* // result.kept = [2, 4, 1]
|
|
21
|
-
* // result.moved = [{item: 1, from: 0, to: 3}]
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```typescript
|
|
26
|
-
* const old = [{id: 1, name: 'a'}, {id: 2, name: 'b'}];
|
|
27
|
-
* const new = [{id: 2, name: 'b'}, {id: 3, name: 'c'}];
|
|
28
|
-
* const result = reconcileArrays(old, new, item => item.id);
|
|
29
|
-
* // result.added = [{id: 3, name: 'c'}]
|
|
30
|
-
* // result.removed = [{id: 1, name: 'a'}]
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export function reconcileArrays(oldArray, newArray, keyFn) {
|
|
34
|
-
const getKey = keyFn || ((item) => item);
|
|
35
|
-
const oldMap = new Map();
|
|
36
|
-
const newMap = new Map();
|
|
37
|
-
oldArray.forEach((item, index) => {
|
|
38
|
-
oldMap.set(getKey(item), { item, index });
|
|
39
|
-
});
|
|
40
|
-
newArray.forEach((item, index) => {
|
|
41
|
-
newMap.set(getKey(item), { item, index });
|
|
42
|
-
});
|
|
43
|
-
const added = [];
|
|
44
|
-
const removed = [];
|
|
45
|
-
const kept = [];
|
|
46
|
-
const moved = [];
|
|
47
|
-
// Find removed items
|
|
48
|
-
oldMap.forEach((value, key) => {
|
|
49
|
-
if (!newMap.has(key)) {
|
|
50
|
-
removed.push(value.item);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
// Find added items and track kept/moved items
|
|
54
|
-
newMap.forEach((value, key) => {
|
|
55
|
-
const oldItem = oldMap.get(key);
|
|
56
|
-
if (!oldItem) {
|
|
57
|
-
added.push(value.item);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
kept.push(value.item);
|
|
61
|
-
if (oldItem.index !== value.index) {
|
|
62
|
-
moved.push({
|
|
63
|
-
item: value.item,
|
|
64
|
-
from: oldItem.index,
|
|
65
|
-
to: value.index
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
return {
|
|
71
|
-
added,
|
|
72
|
-
removed,
|
|
73
|
-
kept,
|
|
74
|
-
moved
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Applies reconciliation patches to transform one array into another
|
|
79
|
-
* @param oldArray - The original array to transform
|
|
80
|
-
* @param newArray - The target array structure
|
|
81
|
-
* @param keyFn - Optional function to generate unique keys for items
|
|
82
|
-
* @returns New array matching the structure of newArray
|
|
83
|
-
*/
|
|
84
|
-
export function applyArrayReconciliation(oldArray, newArray, keyFn) {
|
|
85
|
-
const result = reconcileArrays(oldArray, newArray, keyFn);
|
|
86
|
-
const output = [];
|
|
87
|
-
// Build the new array based on newArray order
|
|
88
|
-
newArray.forEach(item => {
|
|
89
|
-
const key = keyFn ? keyFn(item) : item;
|
|
90
|
-
const isNew = result.added.some(addedItem => (keyFn ? keyFn(addedItem) : addedItem) === key);
|
|
91
|
-
if (isNew) {
|
|
92
|
-
output.push(item);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
// Use the old item reference if it exists
|
|
96
|
-
const oldItem = oldArray.find(oldItem => (keyFn ? keyFn(oldItem) : oldItem) === key);
|
|
97
|
-
if (oldItem !== undefined) {
|
|
98
|
-
output.push(oldItem);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
return output;
|
|
103
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
-
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
-
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @module helpers/array
|
|
8
|
-
*/
|
|
9
|
-
export interface ReconcileResult<T> {
|
|
10
|
-
added: T[];
|
|
11
|
-
removed: T[];
|
|
12
|
-
kept: T[];
|
|
13
|
-
moved: Array<{
|
|
14
|
-
item: T;
|
|
15
|
-
from: number;
|
|
16
|
-
to: number;
|
|
17
|
-
}>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Reconciles two arrays and returns the differences
|
|
21
|
-
* @param oldArray - The original array
|
|
22
|
-
* @param newArray - The new array to compare against
|
|
23
|
-
* @param keyFn - Optional function to generate unique keys for items (for object comparison)
|
|
24
|
-
* @returns Object containing added, removed, kept and moved items
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* const old = [1, 2, 3, 4];
|
|
29
|
-
* const new = [2, 4, 5, 1];
|
|
30
|
-
* const result = reconcileArrays(old, new);
|
|
31
|
-
* // result.added = [5]
|
|
32
|
-
* // result.removed = [3]
|
|
33
|
-
* // result.kept = [2, 4, 1]
|
|
34
|
-
* // result.moved = [{item: 1, from: 0, to: 3}]
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```typescript
|
|
39
|
-
* const old = [{id: 1, name: 'a'}, {id: 2, name: 'b'}];
|
|
40
|
-
* const new = [{id: 2, name: 'b'}, {id: 3, name: 'c'}];
|
|
41
|
-
* const result = reconcileArrays(old, new, item => item.id);
|
|
42
|
-
* // result.added = [{id: 3, name: 'c'}]
|
|
43
|
-
* // result.removed = [{id: 1, name: 'a'}]
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function reconcileArrays<T>(oldArray: T[], newArray: T[], keyFn?: (item: T) => string | number): ReconcileResult<T>;
|
|
47
|
-
/**
|
|
48
|
-
* Applies reconciliation patches to transform one array into another
|
|
49
|
-
* @param oldArray - The original array to transform
|
|
50
|
-
* @param newArray - The target array structure
|
|
51
|
-
* @param keyFn - Optional function to generate unique keys for items
|
|
52
|
-
* @returns New array matching the structure of newArray
|
|
53
|
-
*/
|
|
54
|
-
export declare function applyArrayReconciliation<T>(oldArray: T[], newArray: T[], keyFn?: (item: T) => string | number): T[];
|