@ckeditor/ckeditor5-widget 39.0.2 → 40.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +7 -7
- package/src/augmentation.d.ts +13 -13
- package/src/augmentation.js +5 -5
- package/src/highlightstack.d.ts +74 -74
- package/src/highlightstack.js +129 -129
- package/src/index.d.ts +13 -13
- package/src/index.js +13 -13
- package/src/utils.d.ts +198 -198
- package/src/utils.js +348 -348
- package/src/verticalnavigation.d.ts +15 -15
- package/src/verticalnavigation.js +196 -196
- package/src/widget.d.ts +91 -91
- package/src/widget.js +380 -380
- package/src/widgetresize/resizer.d.ts +177 -177
- package/src/widgetresize/resizer.js +372 -372
- package/src/widgetresize/resizerstate.d.ts +125 -125
- package/src/widgetresize/resizerstate.js +150 -150
- package/src/widgetresize/sizeview.d.ts +55 -55
- package/src/widgetresize/sizeview.js +63 -63
- package/src/widgetresize.d.ts +125 -125
- package/src/widgetresize.js +188 -188
- package/src/widgettoolbarrepository.d.ts +94 -94
- package/src/widgettoolbarrepository.js +268 -268
- package/src/widgettypearound/utils.d.ts +38 -38
- package/src/widgettypearound/utils.js +52 -52
- package/src/widgettypearound/widgettypearound.d.ts +229 -229
- package/src/widgettypearound/widgettypearound.js +773 -773
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-widget",
|
3
|
-
"version": "
|
3
|
+
"version": "40.0.0",
|
4
4
|
"description": "Widget API for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -11,12 +11,12 @@
|
|
11
11
|
],
|
12
12
|
"main": "src/index.js",
|
13
13
|
"dependencies": {
|
14
|
-
"@ckeditor/ckeditor5-core": "
|
15
|
-
"@ckeditor/ckeditor5-engine": "
|
16
|
-
"@ckeditor/ckeditor5-enter": "
|
17
|
-
"@ckeditor/ckeditor5-ui": "
|
18
|
-
"@ckeditor/ckeditor5-utils": "
|
19
|
-
"@ckeditor/ckeditor5-typing": "
|
14
|
+
"@ckeditor/ckeditor5-core": "40.0.0",
|
15
|
+
"@ckeditor/ckeditor5-engine": "40.0.0",
|
16
|
+
"@ckeditor/ckeditor5-enter": "40.0.0",
|
17
|
+
"@ckeditor/ckeditor5-ui": "40.0.0",
|
18
|
+
"@ckeditor/ckeditor5-utils": "40.0.0",
|
19
|
+
"@ckeditor/ckeditor5-typing": "40.0.0",
|
20
20
|
"lodash-es": "4.17.21"
|
21
21
|
},
|
22
22
|
"author": "CKSource (http://cksource.com/)",
|
package/src/augmentation.d.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
import type { Widget, WidgetResize, WidgetToolbarRepository, WidgetTypeAround } from './index';
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
7
|
-
interface PluginsMap {
|
8
|
-
[Widget.pluginName]: Widget;
|
9
|
-
[WidgetResize.pluginName]: WidgetResize;
|
10
|
-
[WidgetToolbarRepository.pluginName]: WidgetToolbarRepository;
|
11
|
-
[WidgetTypeAround.pluginName]: WidgetTypeAround;
|
12
|
-
}
|
13
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
import type { Widget, WidgetResize, WidgetToolbarRepository, WidgetTypeAround } from './index';
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
7
|
+
interface PluginsMap {
|
8
|
+
[Widget.pluginName]: Widget;
|
9
|
+
[WidgetResize.pluginName]: WidgetResize;
|
10
|
+
[WidgetToolbarRepository.pluginName]: WidgetToolbarRepository;
|
11
|
+
[WidgetTypeAround.pluginName]: WidgetTypeAround;
|
12
|
+
}
|
13
|
+
}
|
package/src/augmentation.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
export {};
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export {};
|
package/src/highlightstack.d.ts
CHANGED
@@ -1,74 +1,74 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
import type { DowncastWriter, HighlightDescriptor } from '@ckeditor/ckeditor5-engine';
|
6
|
-
declare const HighlightStack_base: {
|
7
|
-
new (): import("@ckeditor/ckeditor5-utils").Emitter;
|
8
|
-
prototype: import("@ckeditor/ckeditor5-utils").Emitter;
|
9
|
-
};
|
10
|
-
/**
|
11
|
-
* Class used to handle the correct order of highlights on elements.
|
12
|
-
*
|
13
|
-
* When different highlights are applied to same element the correct order should be preserved:
|
14
|
-
*
|
15
|
-
* * highlight with highest priority should be applied,
|
16
|
-
* * if two highlights have same priority - sort by CSS class provided in
|
17
|
-
* {@link module:engine/conversion/downcasthelpers~HighlightDescriptor}.
|
18
|
-
*
|
19
|
-
* This way, highlight will be applied with the same rules it is applied on texts.
|
20
|
-
*/
|
21
|
-
export default class HighlightStack extends HighlightStack_base {
|
22
|
-
private readonly _stack;
|
23
|
-
/**
|
24
|
-
* Adds highlight descriptor to the stack.
|
25
|
-
*
|
26
|
-
* @fires change:top
|
27
|
-
*/
|
28
|
-
add(descriptor: HighlightDescriptor, writer: DowncastWriter): void;
|
29
|
-
/**
|
30
|
-
* Removes highlight descriptor from the stack.
|
31
|
-
*
|
32
|
-
* @fires change:top
|
33
|
-
* @param id Id of the descriptor to remove.
|
34
|
-
*/
|
35
|
-
remove(id: string, writer: DowncastWriter): void;
|
36
|
-
/**
|
37
|
-
* Inserts a given descriptor in correct place in the stack. It also takes care about updating information
|
38
|
-
* when descriptor with same id is already present.
|
39
|
-
*/
|
40
|
-
private _insertDescriptor;
|
41
|
-
/**
|
42
|
-
* Removes descriptor with given id from the stack.
|
43
|
-
*
|
44
|
-
* @param id Descriptor's id.
|
45
|
-
*/
|
46
|
-
private _removeDescriptor;
|
47
|
-
}
|
48
|
-
/**
|
49
|
-
* Fired when top element on {@link module:widget/highlightstack~HighlightStack} has been changed
|
50
|
-
*
|
51
|
-
* @eventName ~HighlightStack#change:top
|
52
|
-
*/
|
53
|
-
export type HighlightStackChangeEvent = {
|
54
|
-
name: 'change' | 'change:top';
|
55
|
-
args: [HighlightStackChangeEventData];
|
56
|
-
};
|
57
|
-
/**
|
58
|
-
* Additional information about the change.
|
59
|
-
*/
|
60
|
-
export type HighlightStackChangeEventData = {
|
61
|
-
/**
|
62
|
-
* Old highlight descriptor. It will be `undefined` when first descriptor is added to the stack.
|
63
|
-
*/
|
64
|
-
oldDescriptor: HighlightDescriptor;
|
65
|
-
/**
|
66
|
-
* New highlight descriptor. It will be `undefined` when last descriptor is removed from the stack.
|
67
|
-
*/
|
68
|
-
newDescriptor: HighlightDescriptor;
|
69
|
-
/**
|
70
|
-
* View writer that can be used to modify element.
|
71
|
-
*/
|
72
|
-
writer: DowncastWriter;
|
73
|
-
};
|
74
|
-
export {};
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
import type { DowncastWriter, HighlightDescriptor } from '@ckeditor/ckeditor5-engine';
|
6
|
+
declare const HighlightStack_base: {
|
7
|
+
new (): import("@ckeditor/ckeditor5-utils").Emitter;
|
8
|
+
prototype: import("@ckeditor/ckeditor5-utils").Emitter;
|
9
|
+
};
|
10
|
+
/**
|
11
|
+
* Class used to handle the correct order of highlights on elements.
|
12
|
+
*
|
13
|
+
* When different highlights are applied to same element the correct order should be preserved:
|
14
|
+
*
|
15
|
+
* * highlight with highest priority should be applied,
|
16
|
+
* * if two highlights have same priority - sort by CSS class provided in
|
17
|
+
* {@link module:engine/conversion/downcasthelpers~HighlightDescriptor}.
|
18
|
+
*
|
19
|
+
* This way, highlight will be applied with the same rules it is applied on texts.
|
20
|
+
*/
|
21
|
+
export default class HighlightStack extends HighlightStack_base {
|
22
|
+
private readonly _stack;
|
23
|
+
/**
|
24
|
+
* Adds highlight descriptor to the stack.
|
25
|
+
*
|
26
|
+
* @fires change:top
|
27
|
+
*/
|
28
|
+
add(descriptor: HighlightDescriptor, writer: DowncastWriter): void;
|
29
|
+
/**
|
30
|
+
* Removes highlight descriptor from the stack.
|
31
|
+
*
|
32
|
+
* @fires change:top
|
33
|
+
* @param id Id of the descriptor to remove.
|
34
|
+
*/
|
35
|
+
remove(id: string, writer: DowncastWriter): void;
|
36
|
+
/**
|
37
|
+
* Inserts a given descriptor in correct place in the stack. It also takes care about updating information
|
38
|
+
* when descriptor with same id is already present.
|
39
|
+
*/
|
40
|
+
private _insertDescriptor;
|
41
|
+
/**
|
42
|
+
* Removes descriptor with given id from the stack.
|
43
|
+
*
|
44
|
+
* @param id Descriptor's id.
|
45
|
+
*/
|
46
|
+
private _removeDescriptor;
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* Fired when top element on {@link module:widget/highlightstack~HighlightStack} has been changed
|
50
|
+
*
|
51
|
+
* @eventName ~HighlightStack#change:top
|
52
|
+
*/
|
53
|
+
export type HighlightStackChangeEvent = {
|
54
|
+
name: 'change' | 'change:top';
|
55
|
+
args: [HighlightStackChangeEventData];
|
56
|
+
};
|
57
|
+
/**
|
58
|
+
* Additional information about the change.
|
59
|
+
*/
|
60
|
+
export type HighlightStackChangeEventData = {
|
61
|
+
/**
|
62
|
+
* Old highlight descriptor. It will be `undefined` when first descriptor is added to the stack.
|
63
|
+
*/
|
64
|
+
oldDescriptor: HighlightDescriptor;
|
65
|
+
/**
|
66
|
+
* New highlight descriptor. It will be `undefined` when last descriptor is removed from the stack.
|
67
|
+
*/
|
68
|
+
newDescriptor: HighlightDescriptor;
|
69
|
+
/**
|
70
|
+
* View writer that can be used to modify element.
|
71
|
+
*/
|
72
|
+
writer: DowncastWriter;
|
73
|
+
};
|
74
|
+
export {};
|
package/src/highlightstack.js
CHANGED
@@ -1,129 +1,129 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module widget/highlightstack
|
7
|
-
*/
|
8
|
-
import { EmitterMixin } from '@ckeditor/ckeditor5-utils';
|
9
|
-
/**
|
10
|
-
* Class used to handle the correct order of highlights on elements.
|
11
|
-
*
|
12
|
-
* When different highlights are applied to same element the correct order should be preserved:
|
13
|
-
*
|
14
|
-
* * highlight with highest priority should be applied,
|
15
|
-
* * if two highlights have same priority - sort by CSS class provided in
|
16
|
-
* {@link module:engine/conversion/downcasthelpers~HighlightDescriptor}.
|
17
|
-
*
|
18
|
-
* This way, highlight will be applied with the same rules it is applied on texts.
|
19
|
-
*/
|
20
|
-
export default class HighlightStack extends EmitterMixin() {
|
21
|
-
constructor() {
|
22
|
-
super(...arguments);
|
23
|
-
this._stack = [];
|
24
|
-
}
|
25
|
-
/**
|
26
|
-
* Adds highlight descriptor to the stack.
|
27
|
-
*
|
28
|
-
* @fires change:top
|
29
|
-
*/
|
30
|
-
add(descriptor, writer) {
|
31
|
-
const stack = this._stack;
|
32
|
-
// Save top descriptor and insert new one. If top is changed - fire event.
|
33
|
-
const oldTop = stack[0];
|
34
|
-
this._insertDescriptor(descriptor);
|
35
|
-
const newTop = stack[0];
|
36
|
-
// When new object is at the top and stores different information.
|
37
|
-
if (oldTop !== newTop && !compareDescriptors(oldTop, newTop)) {
|
38
|
-
this.fire('change:top', {
|
39
|
-
oldDescriptor: oldTop,
|
40
|
-
newDescriptor: newTop,
|
41
|
-
writer
|
42
|
-
});
|
43
|
-
}
|
44
|
-
}
|
45
|
-
/**
|
46
|
-
* Removes highlight descriptor from the stack.
|
47
|
-
*
|
48
|
-
* @fires change:top
|
49
|
-
* @param id Id of the descriptor to remove.
|
50
|
-
*/
|
51
|
-
remove(id, writer) {
|
52
|
-
const stack = this._stack;
|
53
|
-
const oldTop = stack[0];
|
54
|
-
this._removeDescriptor(id);
|
55
|
-
const newTop = stack[0];
|
56
|
-
// When new object is at the top and stores different information.
|
57
|
-
if (oldTop !== newTop && !compareDescriptors(oldTop, newTop)) {
|
58
|
-
this.fire('change:top', {
|
59
|
-
oldDescriptor: oldTop,
|
60
|
-
newDescriptor: newTop,
|
61
|
-
writer
|
62
|
-
});
|
63
|
-
}
|
64
|
-
}
|
65
|
-
/**
|
66
|
-
* Inserts a given descriptor in correct place in the stack. It also takes care about updating information
|
67
|
-
* when descriptor with same id is already present.
|
68
|
-
*/
|
69
|
-
_insertDescriptor(descriptor) {
|
70
|
-
const stack = this._stack;
|
71
|
-
const index = stack.findIndex(item => item.id === descriptor.id);
|
72
|
-
// Inserting exact same descriptor - do nothing.
|
73
|
-
if (compareDescriptors(descriptor, stack[index])) {
|
74
|
-
return;
|
75
|
-
}
|
76
|
-
// If descriptor with same id but with different information is on the stack - remove it.
|
77
|
-
if (index > -1) {
|
78
|
-
stack.splice(index, 1);
|
79
|
-
}
|
80
|
-
// Find correct place to insert descriptor in the stack.
|
81
|
-
// It has different information (for example priority) so it must be re-inserted in correct place.
|
82
|
-
let i = 0;
|
83
|
-
while (stack[i] && shouldABeBeforeB(stack[i], descriptor)) {
|
84
|
-
i++;
|
85
|
-
}
|
86
|
-
stack.splice(i, 0, descriptor);
|
87
|
-
}
|
88
|
-
/**
|
89
|
-
* Removes descriptor with given id from the stack.
|
90
|
-
*
|
91
|
-
* @param id Descriptor's id.
|
92
|
-
*/
|
93
|
-
_removeDescriptor(id) {
|
94
|
-
const stack = this._stack;
|
95
|
-
const index = stack.findIndex(item => item.id === id);
|
96
|
-
// If descriptor with same id is on the list - remove it.
|
97
|
-
if (index > -1) {
|
98
|
-
stack.splice(index, 1);
|
99
|
-
}
|
100
|
-
}
|
101
|
-
}
|
102
|
-
/**
|
103
|
-
* Compares two descriptors by checking their priority and class list.
|
104
|
-
*
|
105
|
-
* @returns Returns true if both descriptors are defined and have same priority and classes.
|
106
|
-
*/
|
107
|
-
function compareDescriptors(a, b) {
|
108
|
-
return a && b && a.priority == b.priority && classesToString(a.classes) == classesToString(b.classes);
|
109
|
-
}
|
110
|
-
/**
|
111
|
-
* Checks whenever first descriptor should be placed in the stack before second one.
|
112
|
-
*/
|
113
|
-
function shouldABeBeforeB(a, b) {
|
114
|
-
if (a.priority > b.priority) {
|
115
|
-
return true;
|
116
|
-
}
|
117
|
-
else if (a.priority < b.priority) {
|
118
|
-
return false;
|
119
|
-
}
|
120
|
-
// When priorities are equal and names are different - use classes to compare.
|
121
|
-
return classesToString(a.classes) > classesToString(b.classes);
|
122
|
-
}
|
123
|
-
/**
|
124
|
-
* Converts CSS classes passed with {@link module:engine/conversion/downcasthelpers~HighlightDescriptor} to
|
125
|
-
* sorted string.
|
126
|
-
*/
|
127
|
-
function classesToString(classes) {
|
128
|
-
return Array.isArray(classes) ? classes.sort().join(',') : classes;
|
129
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module widget/highlightstack
|
7
|
+
*/
|
8
|
+
import { EmitterMixin } from '@ckeditor/ckeditor5-utils';
|
9
|
+
/**
|
10
|
+
* Class used to handle the correct order of highlights on elements.
|
11
|
+
*
|
12
|
+
* When different highlights are applied to same element the correct order should be preserved:
|
13
|
+
*
|
14
|
+
* * highlight with highest priority should be applied,
|
15
|
+
* * if two highlights have same priority - sort by CSS class provided in
|
16
|
+
* {@link module:engine/conversion/downcasthelpers~HighlightDescriptor}.
|
17
|
+
*
|
18
|
+
* This way, highlight will be applied with the same rules it is applied on texts.
|
19
|
+
*/
|
20
|
+
export default class HighlightStack extends EmitterMixin() {
|
21
|
+
constructor() {
|
22
|
+
super(...arguments);
|
23
|
+
this._stack = [];
|
24
|
+
}
|
25
|
+
/**
|
26
|
+
* Adds highlight descriptor to the stack.
|
27
|
+
*
|
28
|
+
* @fires change:top
|
29
|
+
*/
|
30
|
+
add(descriptor, writer) {
|
31
|
+
const stack = this._stack;
|
32
|
+
// Save top descriptor and insert new one. If top is changed - fire event.
|
33
|
+
const oldTop = stack[0];
|
34
|
+
this._insertDescriptor(descriptor);
|
35
|
+
const newTop = stack[0];
|
36
|
+
// When new object is at the top and stores different information.
|
37
|
+
if (oldTop !== newTop && !compareDescriptors(oldTop, newTop)) {
|
38
|
+
this.fire('change:top', {
|
39
|
+
oldDescriptor: oldTop,
|
40
|
+
newDescriptor: newTop,
|
41
|
+
writer
|
42
|
+
});
|
43
|
+
}
|
44
|
+
}
|
45
|
+
/**
|
46
|
+
* Removes highlight descriptor from the stack.
|
47
|
+
*
|
48
|
+
* @fires change:top
|
49
|
+
* @param id Id of the descriptor to remove.
|
50
|
+
*/
|
51
|
+
remove(id, writer) {
|
52
|
+
const stack = this._stack;
|
53
|
+
const oldTop = stack[0];
|
54
|
+
this._removeDescriptor(id);
|
55
|
+
const newTop = stack[0];
|
56
|
+
// When new object is at the top and stores different information.
|
57
|
+
if (oldTop !== newTop && !compareDescriptors(oldTop, newTop)) {
|
58
|
+
this.fire('change:top', {
|
59
|
+
oldDescriptor: oldTop,
|
60
|
+
newDescriptor: newTop,
|
61
|
+
writer
|
62
|
+
});
|
63
|
+
}
|
64
|
+
}
|
65
|
+
/**
|
66
|
+
* Inserts a given descriptor in correct place in the stack. It also takes care about updating information
|
67
|
+
* when descriptor with same id is already present.
|
68
|
+
*/
|
69
|
+
_insertDescriptor(descriptor) {
|
70
|
+
const stack = this._stack;
|
71
|
+
const index = stack.findIndex(item => item.id === descriptor.id);
|
72
|
+
// Inserting exact same descriptor - do nothing.
|
73
|
+
if (compareDescriptors(descriptor, stack[index])) {
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
// If descriptor with same id but with different information is on the stack - remove it.
|
77
|
+
if (index > -1) {
|
78
|
+
stack.splice(index, 1);
|
79
|
+
}
|
80
|
+
// Find correct place to insert descriptor in the stack.
|
81
|
+
// It has different information (for example priority) so it must be re-inserted in correct place.
|
82
|
+
let i = 0;
|
83
|
+
while (stack[i] && shouldABeBeforeB(stack[i], descriptor)) {
|
84
|
+
i++;
|
85
|
+
}
|
86
|
+
stack.splice(i, 0, descriptor);
|
87
|
+
}
|
88
|
+
/**
|
89
|
+
* Removes descriptor with given id from the stack.
|
90
|
+
*
|
91
|
+
* @param id Descriptor's id.
|
92
|
+
*/
|
93
|
+
_removeDescriptor(id) {
|
94
|
+
const stack = this._stack;
|
95
|
+
const index = stack.findIndex(item => item.id === id);
|
96
|
+
// If descriptor with same id is on the list - remove it.
|
97
|
+
if (index > -1) {
|
98
|
+
stack.splice(index, 1);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
/**
|
103
|
+
* Compares two descriptors by checking their priority and class list.
|
104
|
+
*
|
105
|
+
* @returns Returns true if both descriptors are defined and have same priority and classes.
|
106
|
+
*/
|
107
|
+
function compareDescriptors(a, b) {
|
108
|
+
return a && b && a.priority == b.priority && classesToString(a.classes) == classesToString(b.classes);
|
109
|
+
}
|
110
|
+
/**
|
111
|
+
* Checks whenever first descriptor should be placed in the stack before second one.
|
112
|
+
*/
|
113
|
+
function shouldABeBeforeB(a, b) {
|
114
|
+
if (a.priority > b.priority) {
|
115
|
+
return true;
|
116
|
+
}
|
117
|
+
else if (a.priority < b.priority) {
|
118
|
+
return false;
|
119
|
+
}
|
120
|
+
// When priorities are equal and names are different - use classes to compare.
|
121
|
+
return classesToString(a.classes) > classesToString(b.classes);
|
122
|
+
}
|
123
|
+
/**
|
124
|
+
* Converts CSS classes passed with {@link module:engine/conversion/downcasthelpers~HighlightDescriptor} to
|
125
|
+
* sorted string.
|
126
|
+
*/
|
127
|
+
function classesToString(classes) {
|
128
|
+
return Array.isArray(classes) ? classes.sort().join(',') : classes;
|
129
|
+
}
|
package/src/index.d.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module widget
|
7
|
-
*/
|
8
|
-
export { default as Widget } from './widget';
|
9
|
-
export { default as WidgetToolbarRepository } from './widgettoolbarrepository';
|
10
|
-
export { default as WidgetResize } from './widgetresize';
|
11
|
-
export { default as WidgetTypeAround } from './widgettypearound/widgettypearound';
|
12
|
-
export * from './utils';
|
13
|
-
import './augmentation';
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module widget
|
7
|
+
*/
|
8
|
+
export { default as Widget } from './widget';
|
9
|
+
export { default as WidgetToolbarRepository } from './widgettoolbarrepository';
|
10
|
+
export { default as WidgetResize } from './widgetresize';
|
11
|
+
export { default as WidgetTypeAround } from './widgettypearound/widgettypearound';
|
12
|
+
export * from './utils';
|
13
|
+
import './augmentation';
|
package/src/index.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module widget
|
7
|
-
*/
|
8
|
-
export { default as Widget } from './widget';
|
9
|
-
export { default as WidgetToolbarRepository } from './widgettoolbarrepository';
|
10
|
-
export { default as WidgetResize } from './widgetresize';
|
11
|
-
export { default as WidgetTypeAround } from './widgettypearound/widgettypearound';
|
12
|
-
export * from './utils';
|
13
|
-
import './augmentation';
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module widget
|
7
|
+
*/
|
8
|
+
export { default as Widget } from './widget';
|
9
|
+
export { default as WidgetToolbarRepository } from './widgettoolbarrepository';
|
10
|
+
export { default as WidgetResize } from './widgetresize';
|
11
|
+
export { default as WidgetTypeAround } from './widgettypearound/widgettypearound';
|
12
|
+
export * from './utils';
|
13
|
+
import './augmentation';
|