@ckeditor/ckeditor5-widget 39.0.1 → 40.0.0

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 (81) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/LICENSE.md +1 -1
  3. package/README.md +3 -3
  4. package/lang/translations/ar.po +1 -0
  5. package/lang/translations/az.po +1 -0
  6. package/lang/translations/bg.po +1 -0
  7. package/lang/translations/bn.po +1 -0
  8. package/lang/translations/ca.po +1 -0
  9. package/lang/translations/cs.po +1 -0
  10. package/lang/translations/da.po +1 -0
  11. package/lang/translations/de-ch.po +1 -0
  12. package/lang/translations/de.po +1 -0
  13. package/lang/translations/el.po +1 -0
  14. package/lang/translations/en-au.po +1 -0
  15. package/lang/translations/en.po +1 -0
  16. package/lang/translations/es.po +1 -0
  17. package/lang/translations/et.po +1 -0
  18. package/lang/translations/fa.po +1 -0
  19. package/lang/translations/fi.po +1 -0
  20. package/lang/translations/fr.po +1 -0
  21. package/lang/translations/gl.po +1 -0
  22. package/lang/translations/he.po +1 -0
  23. package/lang/translations/hi.po +1 -0
  24. package/lang/translations/hr.po +1 -0
  25. package/lang/translations/hu.po +1 -0
  26. package/lang/translations/id.po +1 -0
  27. package/lang/translations/it.po +1 -0
  28. package/lang/translations/ja.po +1 -0
  29. package/lang/translations/ko.po +1 -0
  30. package/lang/translations/ku.po +1 -0
  31. package/lang/translations/lt.po +1 -0
  32. package/lang/translations/lv.po +1 -0
  33. package/lang/translations/ms.po +1 -0
  34. package/lang/translations/nl.po +1 -0
  35. package/lang/translations/no.po +1 -0
  36. package/lang/translations/pl.po +1 -0
  37. package/lang/translations/pt-br.po +1 -0
  38. package/lang/translations/pt.po +1 -0
  39. package/lang/translations/ro.po +1 -0
  40. package/lang/translations/ru.po +1 -0
  41. package/lang/translations/sk.po +1 -0
  42. package/lang/translations/sq.po +1 -0
  43. package/lang/translations/sr-latn.po +1 -0
  44. package/lang/translations/sr.po +1 -0
  45. package/lang/translations/sv.po +1 -0
  46. package/lang/translations/th.po +1 -0
  47. package/lang/translations/tk.po +1 -0
  48. package/lang/translations/tr.po +1 -0
  49. package/lang/translations/uk.po +1 -0
  50. package/lang/translations/ur.po +1 -0
  51. package/lang/translations/uz.po +1 -0
  52. package/lang/translations/vi.po +1 -0
  53. package/lang/translations/zh-cn.po +1 -0
  54. package/lang/translations/zh.po +1 -0
  55. package/package.json +7 -11
  56. package/src/augmentation.d.ts +13 -13
  57. package/src/augmentation.js +5 -5
  58. package/src/highlightstack.d.ts +74 -74
  59. package/src/highlightstack.js +129 -129
  60. package/src/index.d.ts +13 -13
  61. package/src/index.js +13 -13
  62. package/src/utils.d.ts +198 -198
  63. package/src/utils.js +348 -348
  64. package/src/verticalnavigation.d.ts +15 -15
  65. package/src/verticalnavigation.js +196 -196
  66. package/src/widget.d.ts +91 -91
  67. package/src/widget.js +380 -380
  68. package/src/widgetresize/resizer.d.ts +177 -177
  69. package/src/widgetresize/resizer.js +372 -372
  70. package/src/widgetresize/resizerstate.d.ts +125 -125
  71. package/src/widgetresize/resizerstate.js +150 -150
  72. package/src/widgetresize/sizeview.d.ts +55 -55
  73. package/src/widgetresize/sizeview.js +63 -63
  74. package/src/widgetresize.d.ts +125 -125
  75. package/src/widgetresize.js +188 -188
  76. package/src/widgettoolbarrepository.d.ts +94 -94
  77. package/src/widgettoolbarrepository.js +268 -268
  78. package/src/widgettypearound/utils.d.ts +38 -38
  79. package/src/widgettypearound/utils.js +52 -52
  80. package/src/widgettypearound/widgettypearound.d.ts +229 -229
  81. package/src/widgettypearound/widgettypearound.js +773 -773
@@ -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 {};
@@ -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';