@ckeditor/ckeditor5-core 48.2.0 → 48.3.0-alpha.1

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 (174) hide show
  1. package/dist/accessibility.d.ts +339 -339
  2. package/dist/augmentation.d.ts +8 -8
  3. package/dist/command.d.ts +188 -191
  4. package/dist/commandcollection.d.ts +76 -76
  5. package/dist/context.d.ts +238 -238
  6. package/dist/contextplugin.d.ts +57 -60
  7. package/dist/editingkeystrokehandler.d.ts +49 -49
  8. package/dist/editor/editor.d.ts +538 -576
  9. package/dist/editor/editorconfig.d.ts +1674 -1634
  10. package/dist/editor/utils/attachtoform.d.ts +12 -12
  11. package/dist/editor/utils/editorusagedata.d.ts +51 -51
  12. package/dist/editor/utils/elementapimixin.d.ts +39 -29
  13. package/dist/editor/utils/normalizerootsconfig.d.ts +65 -65
  14. package/dist/editor/utils/registerandinitializerootconfigattributes.d.ts +16 -12
  15. package/dist/editor/utils/rootacceptsblocks.d.ts +13 -13
  16. package/dist/editor/utils/securesourceelement.d.ts +13 -13
  17. package/dist/editor/utils/verifyrootelements.d.ts +8 -8
  18. package/dist/index.css.map +1 -1
  19. package/dist/index.d.ts +27 -27
  20. package/dist/index.js +3416 -3459
  21. package/dist/index.js.map +1 -1
  22. package/dist/legacyerrors.d.ts +0 -4
  23. package/dist/multicommand.d.ts +61 -61
  24. package/dist/pendingactions.d.ts +111 -111
  25. package/dist/plugin.d.ts +291 -283
  26. package/dist/plugincollection.d.ts +109 -108
  27. package/dist/translations/af.js +1 -1
  28. package/dist/translations/af.umd.js +1 -1
  29. package/dist/translations/ar.js +1 -1
  30. package/dist/translations/ar.umd.js +1 -1
  31. package/dist/translations/ast.js +1 -1
  32. package/dist/translations/ast.umd.js +1 -1
  33. package/dist/translations/az.js +1 -1
  34. package/dist/translations/az.umd.js +1 -1
  35. package/dist/translations/be.js +1 -1
  36. package/dist/translations/be.umd.js +1 -1
  37. package/dist/translations/bg.js +1 -1
  38. package/dist/translations/bg.umd.js +1 -1
  39. package/dist/translations/bn.js +1 -1
  40. package/dist/translations/bn.umd.js +1 -1
  41. package/dist/translations/bs.js +1 -1
  42. package/dist/translations/bs.umd.js +1 -1
  43. package/dist/translations/ca.js +1 -1
  44. package/dist/translations/ca.umd.js +1 -1
  45. package/dist/translations/cs.js +1 -1
  46. package/dist/translations/cs.umd.js +1 -1
  47. package/dist/translations/da.js +1 -1
  48. package/dist/translations/da.umd.js +1 -1
  49. package/dist/translations/de-ch.js +1 -1
  50. package/dist/translations/de-ch.umd.js +1 -1
  51. package/dist/translations/de.js +1 -1
  52. package/dist/translations/de.umd.js +1 -1
  53. package/dist/translations/el.js +1 -1
  54. package/dist/translations/el.umd.js +1 -1
  55. package/dist/translations/en-au.js +1 -1
  56. package/dist/translations/en-au.umd.js +1 -1
  57. package/dist/translations/en-gb.js +1 -1
  58. package/dist/translations/en-gb.umd.js +1 -1
  59. package/dist/translations/en.js +1 -1
  60. package/dist/translations/en.umd.js +1 -1
  61. package/dist/translations/eo.js +1 -1
  62. package/dist/translations/eo.umd.js +1 -1
  63. package/dist/translations/es-co.js +1 -1
  64. package/dist/translations/es-co.umd.js +1 -1
  65. package/dist/translations/es.js +1 -1
  66. package/dist/translations/es.umd.js +1 -1
  67. package/dist/translations/et.js +1 -1
  68. package/dist/translations/et.umd.js +1 -1
  69. package/dist/translations/eu.js +1 -1
  70. package/dist/translations/eu.umd.js +1 -1
  71. package/dist/translations/fa.js +1 -1
  72. package/dist/translations/fa.umd.js +1 -1
  73. package/dist/translations/fi.js +1 -1
  74. package/dist/translations/fi.umd.js +1 -1
  75. package/dist/translations/fr.js +1 -1
  76. package/dist/translations/fr.umd.js +1 -1
  77. package/dist/translations/gl.js +1 -1
  78. package/dist/translations/gl.umd.js +1 -1
  79. package/dist/translations/gu.js +1 -1
  80. package/dist/translations/gu.umd.js +1 -1
  81. package/dist/translations/he.js +1 -1
  82. package/dist/translations/he.umd.js +1 -1
  83. package/dist/translations/hi.js +1 -1
  84. package/dist/translations/hi.umd.js +1 -1
  85. package/dist/translations/hr.js +1 -1
  86. package/dist/translations/hr.umd.js +1 -1
  87. package/dist/translations/hu.js +1 -1
  88. package/dist/translations/hu.umd.js +1 -1
  89. package/dist/translations/hy.js +1 -1
  90. package/dist/translations/hy.umd.js +1 -1
  91. package/dist/translations/id.js +1 -1
  92. package/dist/translations/id.umd.js +1 -1
  93. package/dist/translations/it.js +1 -1
  94. package/dist/translations/it.umd.js +1 -1
  95. package/dist/translations/ja.js +1 -1
  96. package/dist/translations/ja.umd.js +1 -1
  97. package/dist/translations/jv.js +1 -1
  98. package/dist/translations/jv.umd.js +1 -1
  99. package/dist/translations/kk.js +1 -1
  100. package/dist/translations/kk.umd.js +1 -1
  101. package/dist/translations/km.js +1 -1
  102. package/dist/translations/km.umd.js +1 -1
  103. package/dist/translations/kn.js +1 -1
  104. package/dist/translations/kn.umd.js +1 -1
  105. package/dist/translations/ko.js +1 -1
  106. package/dist/translations/ko.umd.js +1 -1
  107. package/dist/translations/ku.js +1 -1
  108. package/dist/translations/ku.umd.js +1 -1
  109. package/dist/translations/lt.js +1 -1
  110. package/dist/translations/lt.umd.js +1 -1
  111. package/dist/translations/lv.js +1 -1
  112. package/dist/translations/lv.umd.js +1 -1
  113. package/dist/translations/ms.js +1 -1
  114. package/dist/translations/ms.umd.js +1 -1
  115. package/dist/translations/nb.js +1 -1
  116. package/dist/translations/nb.umd.js +1 -1
  117. package/dist/translations/ne.js +1 -1
  118. package/dist/translations/ne.umd.js +1 -1
  119. package/dist/translations/nl.js +1 -1
  120. package/dist/translations/nl.umd.js +1 -1
  121. package/dist/translations/no.js +1 -1
  122. package/dist/translations/no.umd.js +1 -1
  123. package/dist/translations/oc.js +1 -1
  124. package/dist/translations/oc.umd.js +1 -1
  125. package/dist/translations/pl.js +1 -1
  126. package/dist/translations/pl.umd.js +1 -1
  127. package/dist/translations/pt-br.js +1 -1
  128. package/dist/translations/pt-br.umd.js +1 -1
  129. package/dist/translations/pt.js +1 -1
  130. package/dist/translations/pt.umd.js +1 -1
  131. package/dist/translations/ro.js +1 -1
  132. package/dist/translations/ro.umd.js +1 -1
  133. package/dist/translations/ru.js +1 -1
  134. package/dist/translations/ru.umd.js +1 -1
  135. package/dist/translations/si.js +1 -1
  136. package/dist/translations/si.umd.js +1 -1
  137. package/dist/translations/sk.js +1 -1
  138. package/dist/translations/sk.umd.js +1 -1
  139. package/dist/translations/sl.js +1 -1
  140. package/dist/translations/sl.umd.js +1 -1
  141. package/dist/translations/sq.js +1 -1
  142. package/dist/translations/sq.umd.js +1 -1
  143. package/dist/translations/sr-latn.js +1 -1
  144. package/dist/translations/sr-latn.umd.js +1 -1
  145. package/dist/translations/sr.js +1 -1
  146. package/dist/translations/sr.umd.js +1 -1
  147. package/dist/translations/sv.js +1 -1
  148. package/dist/translations/sv.umd.js +1 -1
  149. package/dist/translations/th.js +1 -1
  150. package/dist/translations/th.umd.js +1 -1
  151. package/dist/translations/ti.js +1 -1
  152. package/dist/translations/ti.umd.js +1 -1
  153. package/dist/translations/tk.js +1 -1
  154. package/dist/translations/tk.umd.js +1 -1
  155. package/dist/translations/tr.js +1 -1
  156. package/dist/translations/tr.umd.js +1 -1
  157. package/dist/translations/tt.js +1 -1
  158. package/dist/translations/tt.umd.js +1 -1
  159. package/dist/translations/ug.js +1 -1
  160. package/dist/translations/ug.umd.js +1 -1
  161. package/dist/translations/uk.js +1 -1
  162. package/dist/translations/uk.umd.js +1 -1
  163. package/dist/translations/ur.js +1 -1
  164. package/dist/translations/ur.umd.js +1 -1
  165. package/dist/translations/uz.js +1 -1
  166. package/dist/translations/uz.umd.js +1 -1
  167. package/dist/translations/vi.js +1 -1
  168. package/dist/translations/vi.umd.js +1 -1
  169. package/dist/translations/zh-cn.js +1 -1
  170. package/dist/translations/zh-cn.umd.js +1 -1
  171. package/dist/translations/zh.js +1 -1
  172. package/dist/translations/zh.umd.js +1 -1
  173. package/dist/typings.d.ts +10 -7
  174. package/package.json +5 -5
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import type { PendingActions } from './index.js';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface PluginsMap {
8
- [PendingActions.pluginName]: PendingActions;
9
- }
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ import type { PendingActions } from "./index.js";
6
+ declare module "@ckeditor/ckeditor5-core" {
7
+ interface PluginsMap {
8
+ [PendingActions.pluginName]: PendingActions;
9
+ }
10
10
  }
package/dist/command.d.ts CHANGED
@@ -1,197 +1,194 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module core/command
7
- */
8
- import { type DecoratedMethodEvent } from '@ckeditor/ckeditor5-utils';
9
- import { type Editor } from './editor/editor.js';
10
- declare const Command_base: {
11
- new (): import("@ckeditor/ckeditor5-utils").Observable;
12
- prototype: import("@ckeditor/ckeditor5-utils").Observable;
13
- };
6
+ * @module core/command
7
+ */
8
+ import { type DecoratedMethodEvent, type ObservableMixinConstructor } from "@ckeditor/ckeditor5-utils";
9
+ import { type Editor } from "./editor/editor.js";
10
+ declare const CommandBase: ObservableMixinConstructor;
14
11
  /**
15
- * Base class for the CKEditor commands.
16
- *
17
- * Commands are the main way to manipulate the editor contents and state. They are mostly used by UI elements (or by other
18
- * commands) to make changes in the model. Commands are available in every part of the code that has access to
19
- * the {@link module:core/editor/editor~Editor editor} instance.
20
- *
21
- * Instances of registered commands can be retrieved from {@link module:core/editor/editor~Editor#commands `editor.commands`}.
22
- * The easiest way to execute a command is through {@link module:core/editor/editor~Editor#execute `editor.execute()`}.
23
- *
24
- * By default, commands are disabled when the editor is in the {@link module:core/editor/editor~Editor#isReadOnly read-only} mode
25
- * but commands with the {@link module:core/command~Command#affectsData `affectsData`} flag set to `false` will not be disabled.
26
- */
27
- export declare class Command extends /* #__PURE__ */ Command_base {
28
- /**
29
- * The editor on which this command will be used.
30
- */
31
- readonly editor: Editor;
32
- /**
33
- * The value of the command. A given command class should define what it represents for it.
34
- *
35
- * For example, the `'bold'` command's value indicates whether the selection starts in a bolded text.
36
- * And the value of the `'link'` command may be an object with link details.
37
- *
38
- * It is possible for a command to have no value (e.g. for stateless actions such as `'uploadImage'`).
39
- *
40
- * A given command class should control this value by overriding the {@link #refresh `refresh()`} method.
41
- *
42
- * @observable
43
- * @readonly
44
- */
45
- value: unknown;
46
- /**
47
- * Flag indicating whether a command is enabled or disabled.
48
- * A disabled command will do nothing when executed.
49
- *
50
- * A given command class should control this value by overriding the {@link #refresh `refresh()`} method.
51
- *
52
- * It is possible to disable a command "from outside" using {@link #forceDisabled} method.
53
- *
54
- * @observable
55
- * @readonly
56
- */
57
- isEnabled: boolean;
58
- /**
59
- * A flag indicating whether a command's `isEnabled` state should be changed depending on where the document
60
- * selection is placed.
61
- *
62
- * By default, it is set to `true`. If the document selection is placed in a
63
- * {@link module:engine/model/model~Model#canEditAt non-editable} place (such as non-editable root), the command becomes disabled.
64
- *
65
- * The flag should be changed to `false` in a concrete command's constructor if the command should not change its `isEnabled`
66
- * accordingly to the document selection.
67
- */
68
- protected _isEnabledBasedOnSelection: boolean;
69
- /**
70
- * A flag indicating whether a command execution changes the editor data or not.
71
- *
72
- * @see #affectsData
73
- */
74
- private _affectsData;
75
- /**
76
- * Holds identifiers for {@link #forceDisabled} mechanism.
77
- */
78
- private readonly _disableStack;
79
- /**
80
- * `Command` class is commonly put in `config.plugins` array.
81
- *
82
- * This property helps with better error detection.
83
- *
84
- * @internal
85
- */
86
- static get _throwErrorWhenUsedAsAPlugin(): true;
87
- /**
88
- * Creates a new `Command` instance.
89
- *
90
- * @param editor The editor on which this command will be used.
91
- */
92
- constructor(editor: Editor);
93
- /**
94
- * A flag indicating whether a command execution changes the editor data or not.
95
- *
96
- * Commands with `affectsData` set to `false` will not be automatically disabled in
97
- * the {@link module:core/editor/editor~Editor#isReadOnly read-only mode} and
98
- * {@glink features/read-only#related-features other editor modes} with restricted user write permissions.
99
- *
100
- * **Note:** You do not have to set it for your every command. It is `true` by default.
101
- *
102
- * @default true
103
- */
104
- get affectsData(): boolean;
105
- protected set affectsData(affectsData: boolean);
106
- /**
107
- * Refreshes the command. The command should update its {@link #isEnabled} and {@link #value} properties
108
- * in this method.
109
- *
110
- * This method is automatically called when
111
- * {@link module:engine/model/document~ModelDocument#event:change any changes are applied to the document}.
112
- */
113
- refresh(): void;
114
- /**
115
- * Disables the command.
116
- *
117
- * Command may be disabled by multiple features or algorithms (at once). When disabling a command, unique id should be passed
118
- * (e.g. the feature name). The same identifier should be used when {@link #clearForceDisabled enabling back} the command.
119
- * The command becomes enabled only after all features {@link #clearForceDisabled enabled it back}.
120
- *
121
- * Disabling and enabling a command:
122
- *
123
- * ```ts
124
- * command.isEnabled; // -> true
125
- * command.forceDisabled( 'MyFeature' );
126
- * command.isEnabled; // -> false
127
- * command.clearForceDisabled( 'MyFeature' );
128
- * command.isEnabled; // -> true
129
- * ```
130
- *
131
- * Command disabled by multiple features:
132
- *
133
- * ```ts
134
- * command.forceDisabled( 'MyFeature' );
135
- * command.forceDisabled( 'OtherFeature' );
136
- * command.clearForceDisabled( 'MyFeature' );
137
- * command.isEnabled; // -> false
138
- * command.clearForceDisabled( 'OtherFeature' );
139
- * command.isEnabled; // -> true
140
- * ```
141
- *
142
- * Multiple disabling with the same identifier is redundant:
143
- *
144
- * ```ts
145
- * command.forceDisabled( 'MyFeature' );
146
- * command.forceDisabled( 'MyFeature' );
147
- * command.clearForceDisabled( 'MyFeature' );
148
- * command.isEnabled; // -> true
149
- * ```
150
- *
151
- * **Note:** some commands or algorithms may have more complex logic when it comes to enabling or disabling certain commands,
152
- * so the command might be still disabled after {@link #clearForceDisabled} was used.
153
- *
154
- * @param id Unique identifier for disabling. Use the same id when {@link #clearForceDisabled enabling back} the command.
155
- */
156
- forceDisabled(id: string): void;
157
- /**
158
- * Clears forced disable previously set through {@link #forceDisabled}. See {@link #forceDisabled}.
159
- *
160
- * @param id Unique identifier, equal to the one passed in {@link #forceDisabled} call.
161
- */
162
- clearForceDisabled(id: string): void;
163
- /**
164
- * Executes the command.
165
- *
166
- * A command may accept parameters. They will be passed from {@link module:core/editor/editor~Editor#execute `editor.execute()`}
167
- * to the command.
168
- *
169
- * The `execute()` method will automatically abort when the command is disabled ({@link #isEnabled} is `false`).
170
- * This behavior is implemented by a high priority listener to the {@link #event:execute} event.
171
- *
172
- * In order to see how to disable a command from "outside" see the {@link #isEnabled} documentation.
173
- *
174
- * This method may return a value, which would be forwarded all the way down to the
175
- * {@link module:core/editor/editor~Editor#execute `editor.execute()`}.
176
- *
177
- * @fires execute
178
- */
179
- execute(...args: Array<unknown>): unknown;
180
- /**
181
- * Destroys the command.
182
- */
183
- destroy(): void;
12
+ * Base class for the CKEditor commands.
13
+ *
14
+ * Commands are the main way to manipulate the editor contents and state. They are mostly used by UI elements (or by other
15
+ * commands) to make changes in the model. Commands are available in every part of the code that has access to
16
+ * the {@link module:core/editor/editor~Editor editor} instance.
17
+ *
18
+ * Instances of registered commands can be retrieved from {@link module:core/editor/editor~Editor#commands `editor.commands`}.
19
+ * The easiest way to execute a command is through {@link module:core/editor/editor~Editor#execute `editor.execute()`}.
20
+ *
21
+ * By default, commands are disabled when the editor is in the {@link module:core/editor/editor~Editor#isReadOnly read-only} mode
22
+ * but commands with the {@link module:core/command~Command#affectsData `affectsData`} flag set to `false` will not be disabled.
23
+ */
24
+ export declare class Command extends CommandBase {
25
+ /**
26
+ * The editor on which this command will be used.
27
+ */
28
+ readonly editor: Editor;
29
+ /**
30
+ * The value of the command. A given command class should define what it represents for it.
31
+ *
32
+ * For example, the `'bold'` command's value indicates whether the selection starts in a bolded text.
33
+ * And the value of the `'link'` command may be an object with link details.
34
+ *
35
+ * It is possible for a command to have no value (e.g. for stateless actions such as `'uploadImage'`).
36
+ *
37
+ * A given command class should control this value by overriding the {@link #refresh `refresh()`} method.
38
+ *
39
+ * @observable
40
+ * @readonly
41
+ */
42
+ value: unknown;
43
+ /**
44
+ * Flag indicating whether a command is enabled or disabled.
45
+ * A disabled command will do nothing when executed.
46
+ *
47
+ * A given command class should control this value by overriding the {@link #refresh `refresh()`} method.
48
+ *
49
+ * It is possible to disable a command "from outside" using {@link #forceDisabled} method.
50
+ *
51
+ * @observable
52
+ * @readonly
53
+ */
54
+ isEnabled: boolean;
55
+ /**
56
+ * A flag indicating whether a command's `isEnabled` state should be changed depending on where the document
57
+ * selection is placed.
58
+ *
59
+ * By default, it is set to `true`. If the document selection is placed in a
60
+ * {@link module:engine/model/model~Model#canEditAt non-editable} place (such as non-editable root), the command becomes disabled.
61
+ *
62
+ * The flag should be changed to `false` in a concrete command's constructor if the command should not change its `isEnabled`
63
+ * accordingly to the document selection.
64
+ */
65
+ protected _isEnabledBasedOnSelection: boolean;
66
+ /**
67
+ * A flag indicating whether a command execution changes the editor data or not.
68
+ *
69
+ * @see #affectsData
70
+ */
71
+ private _affectsData;
72
+ /**
73
+ * Holds identifiers for {@link #forceDisabled} mechanism.
74
+ */
75
+ private readonly _disableStack;
76
+ /**
77
+ * `Command` class is commonly put in `config.plugins` array.
78
+ *
79
+ * This property helps with better error detection.
80
+ *
81
+ * @internal
82
+ */
83
+ static get _throwErrorWhenUsedAsAPlugin(): true;
84
+ /**
85
+ * Creates a new `Command` instance.
86
+ *
87
+ * @param editor The editor on which this command will be used.
88
+ */
89
+ constructor(editor: Editor);
90
+ /**
91
+ * A flag indicating whether a command execution changes the editor data or not.
92
+ *
93
+ * Commands with `affectsData` set to `false` will not be automatically disabled in
94
+ * the {@link module:core/editor/editor~Editor#isReadOnly read-only mode} and
95
+ * {@glink features/read-only#related-features other editor modes} with restricted user write permissions.
96
+ *
97
+ * **Note:** You do not have to set it for your every command. It is `true` by default.
98
+ *
99
+ * @default true
100
+ */
101
+ get affectsData(): boolean;
102
+ protected set affectsData(affectsData: boolean);
103
+ /**
104
+ * Refreshes the command. The command should update its {@link #isEnabled} and {@link #value} properties
105
+ * in this method.
106
+ *
107
+ * This method is automatically called when
108
+ * {@link module:engine/model/document~ModelDocument#event:change any changes are applied to the document}.
109
+ */
110
+ refresh(): void;
111
+ /**
112
+ * Disables the command.
113
+ *
114
+ * Command may be disabled by multiple features or algorithms (at once). When disabling a command, unique id should be passed
115
+ * (e.g. the feature name). The same identifier should be used when {@link #clearForceDisabled enabling back} the command.
116
+ * The command becomes enabled only after all features {@link #clearForceDisabled enabled it back}.
117
+ *
118
+ * Disabling and enabling a command:
119
+ *
120
+ * ```ts
121
+ * command.isEnabled; // -> true
122
+ * command.forceDisabled( 'MyFeature' );
123
+ * command.isEnabled; // -> false
124
+ * command.clearForceDisabled( 'MyFeature' );
125
+ * command.isEnabled; // -> true
126
+ * ```
127
+ *
128
+ * Command disabled by multiple features:
129
+ *
130
+ * ```ts
131
+ * command.forceDisabled( 'MyFeature' );
132
+ * command.forceDisabled( 'OtherFeature' );
133
+ * command.clearForceDisabled( 'MyFeature' );
134
+ * command.isEnabled; // -> false
135
+ * command.clearForceDisabled( 'OtherFeature' );
136
+ * command.isEnabled; // -> true
137
+ * ```
138
+ *
139
+ * Multiple disabling with the same identifier is redundant:
140
+ *
141
+ * ```ts
142
+ * command.forceDisabled( 'MyFeature' );
143
+ * command.forceDisabled( 'MyFeature' );
144
+ * command.clearForceDisabled( 'MyFeature' );
145
+ * command.isEnabled; // -> true
146
+ * ```
147
+ *
148
+ * **Note:** some commands or algorithms may have more complex logic when it comes to enabling or disabling certain commands,
149
+ * so the command might be still disabled after {@link #clearForceDisabled} was used.
150
+ *
151
+ * @param id Unique identifier for disabling. Use the same id when {@link #clearForceDisabled enabling back} the command.
152
+ */
153
+ forceDisabled(id: string): void;
154
+ /**
155
+ * Clears forced disable previously set through {@link #forceDisabled}. See {@link #forceDisabled}.
156
+ *
157
+ * @param id Unique identifier, equal to the one passed in {@link #forceDisabled} call.
158
+ */
159
+ clearForceDisabled(id: string): void;
160
+ /**
161
+ * Executes the command.
162
+ *
163
+ * A command may accept parameters. They will be passed from {@link module:core/editor/editor~Editor#execute `editor.execute()`}
164
+ * to the command.
165
+ *
166
+ * The `execute()` method will automatically abort when the command is disabled ({@link #isEnabled} is `false`).
167
+ * This behavior is implemented by a high priority listener to the {@link #event:execute} event.
168
+ *
169
+ * In order to see how to disable a command from "outside" see the {@link #isEnabled} documentation.
170
+ *
171
+ * This method may return a value, which would be forwarded all the way down to the
172
+ * {@link module:core/editor/editor~Editor#execute `editor.execute()`}.
173
+ *
174
+ * @fires execute
175
+ */
176
+ execute(...args: Array<unknown>): unknown;
177
+ /**
178
+ * Destroys the command.
179
+ */
180
+ destroy(): void;
184
181
  }
185
182
  /**
186
- * Event fired by the {@link module:core/command~Command#execute} method. The command action is a listener to this event so it's
187
- * possible to change/cancel the behavior of the command by listening to this event.
188
- *
189
- * See {@link module:utils/observablemixin~Observable#decorate} for more information and samples.
190
- *
191
- * **Note:** This event is fired even if command is disabled. However, it is automatically blocked
192
- * by a high priority listener in order to prevent command execution.
193
- *
194
- * @eventName ~Command#execute
195
- */
196
- export type CommandExecuteEvent = DecoratedMethodEvent<Command, 'execute'>;
183
+ * Event fired by the {@link module:core/command~Command#execute} method. The command action is a listener to this event so it's
184
+ * possible to change/cancel the behavior of the command by listening to this event.
185
+ *
186
+ * See {@link module:utils/observablemixin~Observable#decorate} for more information and samples.
187
+ *
188
+ * **Note:** This event is fired even if command is disabled. However, it is automatically blocked
189
+ * by a high priority listener in order to prevent command execution.
190
+ *
191
+ * @eventName ~Command#execute
192
+ */
193
+ export type CommandExecuteEvent = DecoratedMethodEvent<Command, "execute">;
197
194
  export {};
@@ -1,83 +1,83 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import { type Command } from './command.js';
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ import { type Command } from "./command.js";
6
6
  /**
7
- * Collection of commands. Its instance is available in {@link module:core/editor/editor~Editor#commands `editor.commands`}.
8
- */
7
+ * Collection of commands. Its instance is available in {@link module:core/editor/editor~Editor#commands `editor.commands`}.
8
+ */
9
9
  export declare class CommandCollection implements Iterable<[string, Command]> {
10
- /**
11
- * Command map.
12
- */
13
- private _commands;
14
- /**
15
- * Creates collection instance.
16
- */
17
- constructor();
18
- /**
19
- * Registers a new command.
20
- *
21
- * @param commandName The name of the command.
22
- */
23
- add<TName extends string>(commandName: TName, command: CommandsMap[TName]): void;
24
- /**
25
- * Retrieves a command from the collection.
26
- *
27
- * @param commandName The name of the command.
28
- */
29
- get<TName extends string>(commandName: TName): CommandsMap[TName] | undefined;
30
- /**
31
- * Executes a command.
32
- *
33
- * @param commandName The name of the command.
34
- * @param commandParams Command parameters.
35
- * @returns The value returned by the {@link module:core/command~Command#execute `command.execute()`}.
36
- */
37
- execute<TName extends string>(commandName: TName, ...commandParams: Parameters<CommandsMap[TName]['execute']>): ReturnType<CommandsMap[TName]['execute']>;
38
- /**
39
- * Returns iterator of command names.
40
- */
41
- names(): IterableIterator<string>;
42
- /**
43
- * Returns iterator of command instances.
44
- */
45
- commands(): IterableIterator<Command>;
46
- /**
47
- * Iterable interface.
48
- *
49
- * Returns `[ commandName, commandInstance ]` pairs.
50
- */
51
- [Symbol.iterator](): Iterator<[string, Command]>;
52
- /**
53
- * Destroys all collection commands.
54
- */
55
- destroy(): void;
10
+ /**
11
+ * Command map.
12
+ */
13
+ private _commands;
14
+ /**
15
+ * Creates collection instance.
16
+ */
17
+ constructor();
18
+ /**
19
+ * Registers a new command.
20
+ *
21
+ * @param commandName The name of the command.
22
+ */
23
+ add<TName extends string>(commandName: TName, command: CommandsMap[TName]): void;
24
+ /**
25
+ * Retrieves a command from the collection.
26
+ *
27
+ * @param commandName The name of the command.
28
+ */
29
+ get<TName extends string>(commandName: TName): CommandsMap[TName] | undefined;
30
+ /**
31
+ * Executes a command.
32
+ *
33
+ * @param commandName The name of the command.
34
+ * @param commandParams Command parameters.
35
+ * @returns The value returned by the {@link module:core/command~Command#execute `command.execute()`}.
36
+ */
37
+ execute<TName extends string>(commandName: TName, ...commandParams: Parameters<CommandsMap[TName]["execute"]>): ReturnType<CommandsMap[TName]["execute"]>;
38
+ /**
39
+ * Returns iterator of command names.
40
+ */
41
+ names(): IterableIterator<string>;
42
+ /**
43
+ * Returns iterator of command instances.
44
+ */
45
+ commands(): IterableIterator<Command>;
46
+ /**
47
+ * Iterable interface.
48
+ *
49
+ * Returns `[ commandName, commandInstance ]` pairs.
50
+ */
51
+ [Symbol.iterator](): Iterator<[string, Command]>;
52
+ /**
53
+ * Destroys all collection commands.
54
+ */
55
+ destroy(): void;
56
56
  }
57
57
  /**
58
- * Helper type that maps command names to their types.
59
- * It is meant to be extended with module augmentation.
60
- *
61
- * ```ts
62
- * class MyCommand extends Command {
63
- * public execute( parameter: A ): B {
64
- * // ...
65
- * }
66
- * }
67
- *
68
- * declare module '@ckeditor/ckeditor5-core' {
69
- * interface CommandsMap {
70
- * myCommand: MyCommand;
71
- * }
72
- * }
73
- *
74
- * // Returns `MyCommand | undefined`.
75
- * const myCommand = editor.commands.get( 'myCommand' );
76
- *
77
- * // Expects `A` type as parameter and returns `B`.
78
- * const value = editor.commands.execute( 'myCommand', new A() );
79
- * ```
80
- */
58
+ * Helper type that maps command names to their types.
59
+ * It is meant to be extended with module augmentation.
60
+ *
61
+ * ```ts
62
+ * class MyCommand extends Command {
63
+ * public execute( parameter: A ): B {
64
+ * // ...
65
+ * }
66
+ * }
67
+ *
68
+ * declare module '@ckeditor/ckeditor5-core' {
69
+ * interface CommandsMap {
70
+ * myCommand: MyCommand;
71
+ * }
72
+ * }
73
+ *
74
+ * // Returns `MyCommand | undefined`.
75
+ * const myCommand = editor.commands.get( 'myCommand' );
76
+ *
77
+ * // Expects `A` type as parameter and returns `B`.
78
+ * const value = editor.commands.execute( 'myCommand', new A() );
79
+ * ```
80
+ */
81
81
  export interface CommandsMap {
82
- [name: string]: Command;
82
+ [name: string]: Command;
83
83
  }