@ckeditor/ckeditor5-core 48.2.0-alpha.7 → 48.3.0-alpha.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 (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,594 +1,556 @@
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 { Config, type Locale, type LocaleTranslate } from '@ckeditor/ckeditor5-utils';
6
- import { Conversion, DataController, EditingController, Model } from '@ckeditor/ckeditor5-engine';
7
- import type { EditorUI } from '@ckeditor/ckeditor5-ui';
8
- import { ContextWatchdog, EditorWatchdog } from '@ckeditor/ckeditor5-watchdog';
9
- import { Context } from '../context.js';
10
- import { PluginCollection } from '../plugincollection.js';
11
- import { CommandCollection, type CommandsMap } from '../commandcollection.js';
12
- import { EditingKeystrokeHandler } from '../editingkeystrokehandler.js';
13
- import { Accessibility } from '../accessibility.js';
14
- import type { LoadedPlugins, PluginConstructor } from '../plugin.js';
15
- import type { EditorConfig } from './editorconfig.js';
16
- import '../../theme/core.css';
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 { Config, type Locale, type LocaleTranslate, type ObservableMixinConstructor } from "@ckeditor/ckeditor5-utils";
6
+ import { Conversion, DataController, EditingController, Model } from "@ckeditor/ckeditor5-engine";
7
+ import type { EditorUI } from "@ckeditor/ckeditor5-ui";
8
+ import { ContextWatchdog, EditorWatchdog } from "@ckeditor/ckeditor5-watchdog";
9
+ import { Context } from "../context.js";
10
+ import { PluginCollection } from "../plugincollection.js";
11
+ import { CommandCollection, type CommandsMap } from "../commandcollection.js";
12
+ import { EditingKeystrokeHandler } from "../editingkeystrokehandler.js";
13
+ import { Accessibility } from "../accessibility.js";
14
+ import type { LoadedPlugins, PluginConstructor } from "../plugin.js";
15
+ import type { EditorConfig } from "./editorconfig.js";
16
+ import "../../theme/core.css";
17
17
  declare global {
18
- var CKEDITOR_GLOBAL_LICENSE_KEY: string | undefined;
19
- var CKEDITOR_WARNING_SUPPRESSIONS: Record<string, boolean>;
18
+ var CKEDITOR_GLOBAL_LICENSE_KEY: string | undefined;
19
+ var CKEDITOR_WARNING_SUPPRESSIONS: Record<string, boolean>;
20
20
  }
21
- declare const Editor_base: {
22
- new (): import("@ckeditor/ckeditor5-utils").Observable;
23
- prototype: import("@ckeditor/ckeditor5-utils").Observable;
24
- };
21
+ declare const EditorBase: ObservableMixinConstructor;
25
22
  /**
26
- * The class representing a basic, generic editor.
27
- *
28
- * Check out the list of its subclasses to learn about specific editor implementations.
29
- *
30
- * All editor implementations (like {@link module:editor-classic/classiceditor~ClassicEditor} or
31
- * {@link module:editor-inline/inlineeditor~InlineEditor}) should extend this class. They can add their
32
- * own methods and properties.
33
- *
34
- * When you are implementing a plugin, this editor represents the API
35
- * which your plugin can expect to get when using its {@link module:core/plugin~Plugin#editor} property.
36
- *
37
- * This API should be sufficient in order to implement the "editing" part of your feature
38
- * (schema definition, conversion, commands, keystrokes, etc.).
39
- * It does not define the editor UI, which is available only if
40
- * the specific editor implements also the {@link ~Editor#ui} property
41
- * (as most editor implementations do).
42
- */
43
- export declare abstract class Editor extends /* #__PURE__ */ Editor_base {
44
- /**
45
- * A required name of the editor class. The name should reflect the constructor name.
46
- */
47
- static get editorName(): `${string}Editor`;
48
- /**
49
- * A namespace for the accessibility features of the editor.
50
- */
51
- readonly accessibility: Accessibility;
52
- /**
53
- * Commands registered to the editor.
54
- *
55
- * Use the shorthand {@link #execute `editor.execute()`} method to execute commands:
56
- *
57
- * ```ts
58
- * // Execute the bold command:
59
- * editor.execute( 'bold' );
60
- *
61
- * // Check the state of the bold command:
62
- * editor.commands.get( 'bold' ).value;
63
- * ```
64
- */
65
- readonly commands: CommandCollection;
66
- /**
67
- * Stores all configurations specific to this editor instance.
68
- *
69
- * ```ts
70
- * editor.config.get( 'image.toolbar' );
71
- * // -> [ 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ]
72
- * ```
73
- */
74
- readonly config: Config<EditorConfig>;
75
- /**
76
- * Conversion manager through which you can register model-to-view and view-to-model converters.
77
- *
78
- * See the {@link module:engine/conversion/conversion~Conversion} documentation to learn how to add converters.
79
- */
80
- readonly conversion: Conversion;
81
- /**
82
- * The {@link module:engine/controller/datacontroller~DataController data controller}.
83
- * Used e.g. for setting and retrieving the editor data.
84
- */
85
- readonly data: DataController;
86
- /**
87
- * The {@link module:engine/controller/editingcontroller~EditingController editing controller}.
88
- * Controls user input and rendering the content for editing.
89
- */
90
- readonly editing: EditingController;
91
- /**
92
- * The locale instance.
93
- */
94
- readonly locale: Locale;
95
- /**
96
- * The editor's model.
97
- *
98
- * The central point of the editor's abstract data model.
99
- */
100
- readonly model: Model;
101
- /**
102
- * The plugins loaded and in use by this editor instance.
103
- *
104
- * ```ts
105
- * editor.plugins.get( 'ClipboardPipeline' ); // -> An instance of the clipboard pipeline plugin.
106
- * ```
107
- */
108
- readonly plugins: PluginCollection<Editor>;
109
- /**
110
- * An instance of the {@link module:core/editingkeystrokehandler~EditingKeystrokeHandler}.
111
- *
112
- * It allows setting simple keystrokes:
113
- *
114
- * ```ts
115
- * // Execute the bold command on Ctrl+E:
116
- * editor.keystrokes.set( 'Ctrl+E', 'bold' );
117
- *
118
- * // Execute your own callback:
119
- * editor.keystrokes.set( 'Ctrl+E', ( data, cancel ) => {
120
- * console.log( data.keyCode );
121
- *
122
- * // Prevent the default (native) action and stop the underlying keydown event
123
- * // so no other editor feature will interfere.
124
- * cancel();
125
- * } );
126
- * ```
127
- *
128
- * Note: Certain typing-oriented keystrokes (like <kbd>Backspace</kbd> or <kbd>Enter</kbd>) are handled
129
- * by a low-level mechanism and trying to listen to them via the keystroke handler will not work reliably.
130
- * To handle these specific keystrokes, see the events fired by the
131
- * {@link module:engine/view/document~ViewDocument editing view document} (`editor.editing.view.document`).
132
- */
133
- readonly keystrokes: EditingKeystrokeHandler;
134
- /**
135
- * Shorthand for {@link module:utils/locale~Locale#t}.
136
- *
137
- * @see module:utils/locale~Locale#t
138
- */
139
- readonly t: LocaleTranslate;
140
- readonly id: string;
141
- /**
142
- * Indicates the editor life-cycle state.
143
- *
144
- * The editor is in one of the following states:
145
- *
146
- * * `initializing` &ndash; During the editor initialization (before
147
- * {@link module:core/editor/editor~Editor.create `Editor.create()`}) finished its job.
148
- * * `ready` &ndash; After the promise returned by the {@link module:core/editor/editor~Editor.create `Editor.create()`}
149
- * method is resolved.
150
- * * `destroyed` &ndash; Once the {@link #destroy `editor.destroy()`} method was called.
151
- *
152
- * @observable
153
- */
154
- state: 'initializing' | 'ready' | 'destroyed';
155
- /**
156
- * The default configuration which is built into the editor class.
157
- *
158
- * It was used in the now deprecated CKEditor 5 builds to provide the default configuration options
159
- * which are later used during the editor initialization.
160
- *
161
- * ```ts
162
- * ClassicEditor.defaultConfig = {
163
- * foo: 1,
164
- * bar: 2
165
- * };
166
- *
167
- * ClassicEditor
168
- * .create( sourceElement )
169
- * .then( editor => {
170
- * editor.config.get( 'foo' ); // -> 1
171
- * editor.config.get( 'bar' ); // -> 2
172
- * } );
173
- *
174
- * // The default options can be overridden by the configuration passed to create().
175
- * ClassicEditor
176
- * .create( { bar: 3 } )
177
- * .then( editor => {
178
- * editor.config.get( 'foo' ); // -> 1
179
- * editor.config.get( 'bar' ); // -> 3
180
- * } );
181
- * ```
182
- *
183
- * See also {@link module:core/editor/editor~Editor.builtinPlugins}.
184
- */
185
- static defaultConfig?: EditorConfig;
186
- /**
187
- * An array of plugins built into this editor class.
188
- *
189
- * It is used in the now deprecated CKEditor 5 builds to provide a list of plugins which are later automatically initialized
190
- * during the editor initialization.
191
- *
192
- * They will be automatically initialized by the editor, unless listed in `config.removePlugins` and
193
- * unless `config.plugins` is passed.
194
- *
195
- * ```ts
196
- * // Build some plugins into the editor class first.
197
- * ClassicEditor.builtinPlugins = [ FooPlugin, BarPlugin ];
198
- *
199
- * // Normally, you need to define config.plugins, but since ClassicEditor.builtinPlugins was
200
- * // defined, now you can call create() without any configuration.
201
- * ClassicEditor
202
- * .create( sourceElement )
203
- * .then( editor => {
204
- * editor.plugins.get( FooPlugin ); // -> An instance of the Foo plugin.
205
- * editor.plugins.get( BarPlugin ); // -> An instance of the Bar plugin.
206
- * } );
207
- *
208
- * ClassicEditor
209
- * .create( {
210
- * // Do not initialize these plugins (note: it is defined by a string):
211
- * removePlugins: [ 'Foo' ]
212
- * } )
213
- * .then( editor => {
214
- * editor.plugins.get( FooPlugin ); // -> Undefined.
215
- * editor.config.get( BarPlugin ); // -> An instance of the Bar plugin.
216
- * } );
217
- *
218
- * ClassicEditor
219
- * .create( {
220
- * // Load only this plugin. It can also be defined by a string if
221
- * // this plugin was built into the editor class.
222
- * plugins: [ FooPlugin ]
223
- * } )
224
- * .then( editor => {
225
- * editor.plugins.get( FooPlugin ); // -> An instance of the Foo plugin.
226
- * editor.config.get( BarPlugin ); // -> Undefined.
227
- * } );
228
- * ```
229
- *
230
- * See also {@link module:core/editor/editor~Editor.defaultConfig}.
231
- */
232
- static builtinPlugins?: Array<PluginConstructor<Editor>>;
233
- /**
234
- * The editor UI instance.
235
- */
236
- abstract get ui(): EditorUI;
237
- /**
238
- * The editor context.
239
- * When it is not provided through the configuration, the editor creates it.
240
- */
241
- protected readonly _context: Context;
242
- /**
243
- * A set of lock IDs for the {@link #isReadOnly} getter.
244
- */
245
- protected readonly _readOnlyLocks: Set<symbol | string>;
246
- /**
247
- * Holds attributes keys that were passed in
248
- * {@link module:core/editor/editorconfig~EditorConfig#roots `config.roots.<rootName>.modelAttributes`}
249
- * or {@link module:core/editor/editorconfig~EditorConfig#root `config.root.modelAttributes`}.
250
- */
251
- protected readonly _registeredRootsAttributesKeys: Set<string>;
252
- /**
253
- * `Editor` class is commonly put in `config.plugins` array.
254
- *
255
- * This property helps with better error detection.
256
- *
257
- * @internal
258
- */
259
- static get _throwErrorWhenUsedAsAPlugin(): true;
260
- /**
261
- * Creates a new instance of the editor class.
262
- *
263
- * Usually, not to be used directly. See the static {@link module:core/editor/editor~Editor.create `create()`} method.
264
- *
265
- * @param config The editor configuration.
266
- */
267
- constructor(config?: EditorConfig);
268
- /**
269
- * Defines whether the editor is in the read-only mode.
270
- *
271
- * In read-only mode the editor {@link #commands commands} are disabled so it is not possible
272
- * to modify the document by using them. Also, the editable element(s) become non-editable.
273
- *
274
- * In order to make the editor read-only, you need to call the {@link #enableReadOnlyMode} method:
275
- *
276
- * ```ts
277
- * editor.enableReadOnlyMode( 'feature-id' );
278
- * ```
279
- *
280
- * Later, to turn off the read-only mode, call {@link #disableReadOnlyMode}:
281
- *
282
- * ```ts
283
- * editor.disableReadOnlyMode( 'feature-id' );
284
- * ```
285
- *
286
- * @readonly
287
- * @observable
288
- */
289
- get isReadOnly(): boolean;
290
- set isReadOnly(value: boolean);
291
- /**
292
- * Turns on the read-only mode in the editor.
293
- *
294
- * Editor can be switched to or out of the read-only mode by many features, under various circumstances. The editor supports locking
295
- * mechanism for the read-only mode. It enables easy control over the read-only mode when many features wants to turn it on or off at
296
- * the same time, without conflicting with each other. It guarantees that you will not make the editor editable accidentally (which
297
- * could lead to errors).
298
- *
299
- * Each read-only mode request is identified by a unique id (also called "lock"). If multiple plugins requested to turn on the
300
- * read-only mode, then, the editor will become editable only after all these plugins turn the read-only mode off (using the same ids).
301
- *
302
- * Note, that you cannot force the editor to disable the read-only mode if other plugins set it.
303
- *
304
- * After the first `enableReadOnlyMode()` call, the {@link #isReadOnly `isReadOnly` property} will be set to `true`:
305
- *
306
- * ```ts
307
- * editor.isReadOnly; // `false`.
308
- * editor.enableReadOnlyMode( 'my-feature-id' );
309
- * editor.isReadOnly; // `true`.
310
- * ```
311
- *
312
- * You can turn off the read-only mode ("clear the lock") using the {@link #disableReadOnlyMode `disableReadOnlyMode()`} method:
313
- *
314
- * ```ts
315
- * editor.enableReadOnlyMode( 'my-feature-id' );
316
- * // ...
317
- * editor.disableReadOnlyMode( 'my-feature-id' );
318
- * editor.isReadOnly; // `false`.
319
- * ```
320
- *
321
- * All "locks" need to be removed to enable editing:
322
- *
323
- * ```ts
324
- * editor.enableReadOnlyMode( 'my-feature-id' );
325
- * editor.enableReadOnlyMode( 'my-other-feature-id' );
326
- * // ...
327
- * editor.disableReadOnlyMode( 'my-feature-id' );
328
- * editor.isReadOnly; // `true`.
329
- * editor.disableReadOnlyMode( 'my-other-feature-id' );
330
- * editor.isReadOnly; // `false`.
331
- * ```
332
- *
333
- * @param lockId A unique ID for setting the editor to the read-only state.
334
- */
335
- enableReadOnlyMode(lockId: string | symbol): void;
336
- /**
337
- * Removes the read-only lock from the editor with given lock ID.
338
- *
339
- * When no lock is present on the editor anymore, then the {@link #isReadOnly `isReadOnly` property} will be set to `false`.
340
- *
341
- * @param lockId The lock ID for setting the editor to the read-only state.
342
- */
343
- disableReadOnlyMode(lockId: string | symbol): void;
344
- /**
345
- * Sets the data in the editor.
346
- *
347
- * ```ts
348
- * editor.setData( '<p>This is editor!</p>' );
349
- * ```
350
- *
351
- * If your editor implementation uses multiple roots, you should pass an object with keys corresponding
352
- * to the editor root names and values equal to the data that should be set in each root:
353
- *
354
- * ```ts
355
- * editor.setData( {
356
- * header: '<p>Content for header part.</p>',
357
- * content: '<p>Content for main part.</p>',
358
- * footer: '<p>Content for footer part.</p>'
359
- * } );
360
- * ```
361
- *
362
- * By default the editor accepts HTML. This can be controlled by injecting a different data processor.
363
- * See the {@glink features/markdown Markdown output} guide for more details.
364
- *
365
- * @param data Input data.
366
- */
367
- setData(data: string | Record<string, string>): void;
368
- /**
369
- * Gets the data from the editor.
370
- *
371
- * ```ts
372
- * editor.getData(); // -> '<p>This is editor!</p>'
373
- * ```
374
- *
375
- * If your editor implementation uses multiple roots, you should pass root name as one of the options:
376
- *
377
- * ```ts
378
- * editor.getData( { rootName: 'header' } ); // -> '<p>Content for header part.</p>'
379
- * ```
380
- *
381
- * By default, the editor outputs HTML. This can be controlled by injecting a different data processor.
382
- * See the {@glink features/markdown Markdown output} guide for more details.
383
- *
384
- * A warning is logged when you try to retrieve data for a detached root, as most probably this is a mistake. A detached root should
385
- * be treated like it is removed, and you should not save its data. Note, that the detached root data is always an empty string.
386
- *
387
- * @param options Additional configuration for the retrieved data.
388
- * Editor features may introduce more configuration options that can be set through this parameter.
389
- * @param options.rootName Root name. Defaults to `'main'`.
390
- * @param options.trim Whether returned data should be trimmed. This option is set to `'empty'` by default,
391
- * which means that whenever editor content is considered empty, an empty string is returned. To turn off trimming
392
- * use `'none'`. In such cases exact content will be returned (for example `'<p>&nbsp;</p>'` for an empty editor).
393
- * @returns Output data.
394
- */
395
- getData(options?: {
396
- rootName?: string;
397
- trim?: 'empty' | 'none';
398
- [key: string]: unknown;
399
- }): string;
400
- /**
401
- * Loads and initializes plugins specified in the configuration.
402
- *
403
- * @returns A promise which resolves once the initialization is completed, providing an array of loaded plugins.
404
- */
405
- initPlugins(): Promise<LoadedPlugins>;
406
- /**
407
- * Destroys the editor instance, releasing all resources used by it.
408
- *
409
- * **Note** The editor cannot be destroyed during the initialization phase so if it is called
410
- * while the editor {@link #state is being initialized}, it will wait for the editor initialization before destroying it.
411
- *
412
- * @fires destroy
413
- * @returns A promise that resolves once the editor instance is fully destroyed.
414
- */
415
- destroy(): Promise<unknown>;
416
- /**
417
- * Executes the specified command with given parameters.
418
- *
419
- * Shorthand for:
420
- *
421
- * ```ts
422
- * editor.commands.get( commandName ).execute( ... );
423
- * ```
424
- *
425
- * @param commandName The name of the command to execute.
426
- * @param commandParams Command parameters.
427
- * @returns The value returned by the {@link module:core/commandcollection~CommandCollection#execute `commands.execute()`}.
428
- */
429
- execute<TName extends string>(commandName: TName, ...commandParams: Parameters<CommandsMap[TName]['execute']>): ReturnType<CommandsMap[TName]['execute']>;
430
- /**
431
- * Focuses the editor.
432
- *
433
- * **Note** To explicitly focus the editing area of the editor, use the
434
- * {@link module:engine/view/view~EditingView#focus `editor.editing.view.focus()`} method of the editing view.
435
- *
436
- * Check out the {@glink framework/deep-dive/ui/focus-tracking#focus-in-the-editor-ui Focus in the editor UI} section
437
- * of the {@glink framework/deep-dive/ui/focus-tracking Deep dive into focus tracking} guide to learn more.
438
- */
439
- focus(): void;
440
- /**
441
- * Registers a given string as a root attribute key. Registered root attributes are added to
442
- * the {@link module:engine/model/schema~ModelSchema schema}.
443
- *
444
- * **Note:** Attributes passed in the configuration for multi-root editors
445
- * ({@link module:core/editor/editorconfig~EditorConfig#roots `config.roots.<rootName>.modelAttributes`}) or
446
- * single-root editors ({@link module:core/editor/editorconfig~EditorConfig#root `config.root.modelAttributes`})
447
- * are automatically registered when the editor is initialized. However, registering the same attribute twice
448
- * does not have any negative impact, so it is recommended to use this method in any feature that uses
449
- * root attributes.
450
- *
451
- * **Note:** Registered attributes are attached only to the generic `$root` schema element. A custom root
452
- * {@link module:core/editor/editorconfig~RootConfig#modelElement `modelElement`} must opt into the `$root`
453
- * attribute chain via `allowAttributesOf: '$root'` to inherit these attributes.
454
- * See the {@glink framework/deep-dive/schema#custom-root-elements Custom root elements} section of the
455
- * {@glink framework/deep-dive/schema Schema deep-dive} guide for more details.
456
- */
457
- registerRootAttribute(key: string): void;
458
- /**
459
- * Returns attributes for the specified root.
460
- * If no root name is provided, it returns attributes for the 'main' root by default.
461
- *
462
- * Note: all and only {@link ~Editor#registerRootAttribute registered} roots attributes will be returned.
463
- * If a registered root attribute is not set for a given root, `null` will be returned.
464
- */
465
- getRootAttributes(rootName?: string): EditorRootAttributes;
466
- /**
467
- * Creates and initializes a new editor instance.
468
- *
469
- * This is an abstract method. Every editor type needs to implement its own initialization logic.
470
- *
471
- * See the `create()` methods of the existing editor types to learn how to use them:
472
- *
473
- * * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}
474
- * * {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}
475
- * * {@link module:editor-decoupled/decouplededitor~DecoupledEditor.create `DecoupledEditor.create()`}
476
- * * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}
477
- */
478
- static create(...args: Array<unknown>): void;
479
- /**
480
- * The {@link module:core/context~Context} class.
481
- *
482
- * Exposed as static editor field for easier access in editor builds.
483
- */
484
- static Context: typeof Context;
485
- /**
486
- * The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
487
- *
488
- * Exposed as static editor field for easier access in editor builds.
489
- */
490
- static EditorWatchdog: typeof EditorWatchdog;
491
- /**
492
- * The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
493
- *
494
- * Exposed as static editor field for easier access in editor builds.
495
- */
496
- static ContextWatchdog: typeof ContextWatchdog;
497
- protected _showLicenseError(reason: LicenseErrorReason, name?: string): void;
498
- /**
499
- * This part of the code is _not_ executed in installations under the GPL license (with `config.licenseKey = 'GPL'`).
500
- *
501
- * It is only executed when a specific license key is provided. If you are uncertain whether
502
- * this applies to your installation, please contact our support team.
503
- */
504
- private _sendUsageRequest;
23
+ * The class representing a basic, generic editor.
24
+ *
25
+ * Check out the list of its subclasses to learn about specific editor implementations.
26
+ *
27
+ * All editor implementations (like {@link module:editor-classic/classiceditor~ClassicEditor} or
28
+ * {@link module:editor-inline/inlineeditor~InlineEditor}) should extend this class. They can add their
29
+ * own methods and properties.
30
+ *
31
+ * When you are implementing a plugin, this editor represents the API
32
+ * which your plugin can expect to get when using its {@link module:core/plugin~Plugin#editor} property.
33
+ *
34
+ * This API should be sufficient in order to implement the "editing" part of your feature
35
+ * (schema definition, conversion, commands, keystrokes, etc.).
36
+ * It does not define the editor UI, which is available only if
37
+ * the specific editor implements also the {@link ~Editor#ui} property
38
+ * (as most editor implementations do).
39
+ */
40
+ export declare abstract class Editor extends EditorBase {
41
+ /**
42
+ * A required name of the editor class. The name should reflect the constructor name.
43
+ */
44
+ static get editorName(): `${string}Editor`;
45
+ /**
46
+ * A namespace for the accessibility features of the editor.
47
+ */
48
+ readonly accessibility: Accessibility;
49
+ /**
50
+ * Commands registered to the editor.
51
+ *
52
+ * Use the shorthand {@link #execute `editor.execute()`} method to execute commands:
53
+ *
54
+ * ```ts
55
+ * // Execute the bold command:
56
+ * editor.execute( 'bold' );
57
+ *
58
+ * // Check the state of the bold command:
59
+ * editor.commands.get( 'bold' ).value;
60
+ * ```
61
+ */
62
+ readonly commands: CommandCollection;
63
+ /**
64
+ * Stores all configurations specific to this editor instance.
65
+ *
66
+ * ```ts
67
+ * editor.config.get( 'image.toolbar' );
68
+ * // -> [ 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ]
69
+ * ```
70
+ */
71
+ readonly config: Config<EditorConfig>;
72
+ /**
73
+ * Conversion manager through which you can register model-to-view and view-to-model converters.
74
+ *
75
+ * See the {@link module:engine/conversion/conversion~Conversion} documentation to learn how to add converters.
76
+ */
77
+ readonly conversion: Conversion;
78
+ /**
79
+ * The {@link module:engine/controller/datacontroller~DataController data controller}.
80
+ * Used e.g. for setting and retrieving the editor data.
81
+ */
82
+ readonly data: DataController;
83
+ /**
84
+ * The {@link module:engine/controller/editingcontroller~EditingController editing controller}.
85
+ * Controls user input and rendering the content for editing.
86
+ */
87
+ readonly editing: EditingController;
88
+ /**
89
+ * The locale instance.
90
+ */
91
+ readonly locale: Locale;
92
+ /**
93
+ * The editor's model.
94
+ *
95
+ * The central point of the editor's abstract data model.
96
+ */
97
+ readonly model: Model;
98
+ /**
99
+ * The plugins loaded and in use by this editor instance.
100
+ *
101
+ * ```ts
102
+ * editor.plugins.get( 'ClipboardPipeline' ); // -> An instance of the clipboard pipeline plugin.
103
+ * ```
104
+ */
105
+ readonly plugins: PluginCollection<Editor>;
106
+ /**
107
+ * An instance of the {@link module:core/editingkeystrokehandler~EditingKeystrokeHandler}.
108
+ *
109
+ * It allows setting simple keystrokes:
110
+ *
111
+ * ```ts
112
+ * // Execute the bold command on Ctrl+E:
113
+ * editor.keystrokes.set( 'Ctrl+E', 'bold' );
114
+ *
115
+ * // Execute your own callback:
116
+ * editor.keystrokes.set( 'Ctrl+E', ( data, cancel ) => {
117
+ * console.log( data.keyCode );
118
+ *
119
+ * // Prevent the default (native) action and stop the underlying keydown event
120
+ * // so no other editor feature will interfere.
121
+ * cancel();
122
+ * } );
123
+ * ```
124
+ *
125
+ * Note: Certain typing-oriented keystrokes (like <kbd>Backspace</kbd> or <kbd>Enter</kbd>) are handled
126
+ * by a low-level mechanism and trying to listen to them via the keystroke handler will not work reliably.
127
+ * To handle these specific keystrokes, see the events fired by the
128
+ * {@link module:engine/view/document~ViewDocument editing view document} (`editor.editing.view.document`).
129
+ */
130
+ readonly keystrokes: EditingKeystrokeHandler;
131
+ /**
132
+ * Shorthand for {@link module:utils/locale~Locale#t}.
133
+ *
134
+ * @see module:utils/locale~Locale#t
135
+ */
136
+ readonly t: LocaleTranslate;
137
+ readonly id: string;
138
+ /**
139
+ * Indicates the editor life-cycle state.
140
+ *
141
+ * The editor is in one of the following states:
142
+ *
143
+ * * `initializing` &ndash; During the editor initialization (before
144
+ * {@link module:core/editor/editor~Editor.create `Editor.create()`}) finished its job.
145
+ * * `ready` &ndash; After the promise returned by the {@link module:core/editor/editor~Editor.create `Editor.create()`}
146
+ * method is resolved.
147
+ * * `destroyed` &ndash; Once the {@link #destroy `editor.destroy()`} method was called.
148
+ *
149
+ * @observable
150
+ */
151
+ state: "initializing" | "ready" | "destroyed";
152
+ /**
153
+ * The default configuration which is built into the editor class.
154
+ *
155
+ * It was used in the now deprecated CKEditor 5 builds to provide the default configuration options
156
+ * which are later used during the editor initialization.
157
+ *
158
+ * ```ts
159
+ * ClassicEditor.defaultConfig = {
160
+ * foo: 1,
161
+ * bar: 2
162
+ * };
163
+ *
164
+ * ClassicEditor
165
+ * .create( sourceElement )
166
+ * .then( editor => {
167
+ * editor.config.get( 'foo' ); // -> 1
168
+ * editor.config.get( 'bar' ); // -> 2
169
+ * } );
170
+ *
171
+ * // The default options can be overridden by the configuration passed to create().
172
+ * ClassicEditor
173
+ * .create( { bar: 3 } )
174
+ * .then( editor => {
175
+ * editor.config.get( 'foo' ); // -> 1
176
+ * editor.config.get( 'bar' ); // -> 3
177
+ * } );
178
+ * ```
179
+ *
180
+ * See also {@link module:core/editor/editor~Editor.builtinPlugins}.
181
+ */
182
+ static defaultConfig?: EditorConfig;
183
+ /**
184
+ * An array of plugins built into this editor class.
185
+ *
186
+ * It is used in the now deprecated CKEditor 5 builds to provide a list of plugins which are later automatically initialized
187
+ * during the editor initialization.
188
+ *
189
+ * They will be automatically initialized by the editor, unless listed in `config.removePlugins` and
190
+ * unless `config.plugins` is passed.
191
+ *
192
+ * ```ts
193
+ * // Build some plugins into the editor class first.
194
+ * ClassicEditor.builtinPlugins = [ FooPlugin, BarPlugin ];
195
+ *
196
+ * // Normally, you need to define config.plugins, but since ClassicEditor.builtinPlugins was
197
+ * // defined, now you can call create() without any configuration.
198
+ * ClassicEditor
199
+ * .create( sourceElement )
200
+ * .then( editor => {
201
+ * editor.plugins.get( FooPlugin ); // -> An instance of the Foo plugin.
202
+ * editor.plugins.get( BarPlugin ); // -> An instance of the Bar plugin.
203
+ * } );
204
+ *
205
+ * ClassicEditor
206
+ * .create( {
207
+ * // Do not initialize these plugins (note: it is defined by a string):
208
+ * removePlugins: [ 'Foo' ]
209
+ * } )
210
+ * .then( editor => {
211
+ * editor.plugins.get( FooPlugin ); // -> Undefined.
212
+ * editor.config.get( BarPlugin ); // -> An instance of the Bar plugin.
213
+ * } );
214
+ *
215
+ * ClassicEditor
216
+ * .create( {
217
+ * // Load only this plugin. It can also be defined by a string if
218
+ * // this plugin was built into the editor class.
219
+ * plugins: [ FooPlugin ]
220
+ * } )
221
+ * .then( editor => {
222
+ * editor.plugins.get( FooPlugin ); // -> An instance of the Foo plugin.
223
+ * editor.config.get( BarPlugin ); // -> Undefined.
224
+ * } );
225
+ * ```
226
+ *
227
+ * See also {@link module:core/editor/editor~Editor.defaultConfig}.
228
+ */
229
+ static builtinPlugins?: Array<PluginConstructor<Editor>>;
230
+ /**
231
+ * The editor UI instance.
232
+ */
233
+ abstract get ui(): EditorUI;
234
+ /**
235
+ * The editor context.
236
+ * When it is not provided through the configuration, the editor creates it.
237
+ */
238
+ protected readonly _context: Context;
239
+ /**
240
+ * A set of lock IDs for the {@link #isReadOnly} getter.
241
+ */
242
+ protected readonly _readOnlyLocks: Set<symbol | string>;
243
+ /**
244
+ * Holds attributes keys that were passed in
245
+ * {@link module:core/editor/editorconfig~EditorConfig#roots `config.roots.<rootName>.modelAttributes`}
246
+ * or {@link module:core/editor/editorconfig~EditorConfig#root `config.root.modelAttributes`}.
247
+ */
248
+ protected readonly _registeredRootsAttributesKeys: Set<string>;
249
+ /**
250
+ * `Editor` class is commonly put in `config.plugins` array.
251
+ *
252
+ * This property helps with better error detection.
253
+ *
254
+ * @internal
255
+ */
256
+ static get _throwErrorWhenUsedAsAPlugin(): true;
257
+ /**
258
+ * Creates a new instance of the editor class.
259
+ *
260
+ * Usually, not to be used directly. See the static {@link module:core/editor/editor~Editor.create `create()`} method.
261
+ *
262
+ * @param config The editor configuration.
263
+ */
264
+ constructor(config?: EditorConfig);
265
+ /**
266
+ * Defines whether the editor is in the read-only mode.
267
+ *
268
+ * In read-only mode the editor {@link #commands commands} are disabled so it is not possible
269
+ * to modify the document by using them. Also, the editable element(s) become non-editable.
270
+ *
271
+ * In order to make the editor read-only, you need to call the {@link #enableReadOnlyMode} method:
272
+ *
273
+ * ```ts
274
+ * editor.enableReadOnlyMode( 'feature-id' );
275
+ * ```
276
+ *
277
+ * Later, to turn off the read-only mode, call {@link #disableReadOnlyMode}:
278
+ *
279
+ * ```ts
280
+ * editor.disableReadOnlyMode( 'feature-id' );
281
+ * ```
282
+ *
283
+ * @readonly
284
+ * @observable
285
+ */
286
+ get isReadOnly(): boolean;
287
+ set isReadOnly(value: boolean);
288
+ /**
289
+ * Turns on the read-only mode in the editor.
290
+ *
291
+ * Editor can be switched to or out of the read-only mode by many features, under various circumstances. The editor supports locking
292
+ * mechanism for the read-only mode. It enables easy control over the read-only mode when many features wants to turn it on or off at
293
+ * the same time, without conflicting with each other. It guarantees that you will not make the editor editable accidentally (which
294
+ * could lead to errors).
295
+ *
296
+ * Each read-only mode request is identified by a unique id (also called "lock"). If multiple plugins requested to turn on the
297
+ * read-only mode, then, the editor will become editable only after all these plugins turn the read-only mode off (using the same ids).
298
+ *
299
+ * Note, that you cannot force the editor to disable the read-only mode if other plugins set it.
300
+ *
301
+ * After the first `enableReadOnlyMode()` call, the {@link #isReadOnly `isReadOnly` property} will be set to `true`:
302
+ *
303
+ * ```ts
304
+ * editor.isReadOnly; // `false`.
305
+ * editor.enableReadOnlyMode( 'my-feature-id' );
306
+ * editor.isReadOnly; // `true`.
307
+ * ```
308
+ *
309
+ * You can turn off the read-only mode ("clear the lock") using the {@link #disableReadOnlyMode `disableReadOnlyMode()`} method:
310
+ *
311
+ * ```ts
312
+ * editor.enableReadOnlyMode( 'my-feature-id' );
313
+ * // ...
314
+ * editor.disableReadOnlyMode( 'my-feature-id' );
315
+ * editor.isReadOnly; // `false`.
316
+ * ```
317
+ *
318
+ * All "locks" need to be removed to enable editing:
319
+ *
320
+ * ```ts
321
+ * editor.enableReadOnlyMode( 'my-feature-id' );
322
+ * editor.enableReadOnlyMode( 'my-other-feature-id' );
323
+ * // ...
324
+ * editor.disableReadOnlyMode( 'my-feature-id' );
325
+ * editor.isReadOnly; // `true`.
326
+ * editor.disableReadOnlyMode( 'my-other-feature-id' );
327
+ * editor.isReadOnly; // `false`.
328
+ * ```
329
+ *
330
+ * @param lockId A unique ID for setting the editor to the read-only state.
331
+ */
332
+ enableReadOnlyMode(lockId: string | symbol): void;
333
+ /**
334
+ * Removes the read-only lock from the editor with given lock ID.
335
+ *
336
+ * When no lock is present on the editor anymore, then the {@link #isReadOnly `isReadOnly` property} will be set to `false`.
337
+ *
338
+ * @param lockId The lock ID for setting the editor to the read-only state.
339
+ */
340
+ disableReadOnlyMode(lockId: string | symbol): void;
341
+ /**
342
+ * Sets the data in the editor.
343
+ *
344
+ * ```ts
345
+ * editor.setData( '<p>This is editor!</p>' );
346
+ * ```
347
+ *
348
+ * If your editor implementation uses multiple roots, you should pass an object with keys corresponding
349
+ * to the editor root names and values equal to the data that should be set in each root:
350
+ *
351
+ * ```ts
352
+ * editor.setData( {
353
+ * header: '<p>Content for header part.</p>',
354
+ * content: '<p>Content for main part.</p>',
355
+ * footer: '<p>Content for footer part.</p>'
356
+ * } );
357
+ * ```
358
+ *
359
+ * By default the editor accepts HTML. This can be controlled by injecting a different data processor.
360
+ * See the {@glink features/markdown Markdown output} guide for more details.
361
+ *
362
+ * @param data Input data.
363
+ */
364
+ setData(data: string | Record<string, string>): void;
365
+ /**
366
+ * Gets the data from the editor.
367
+ *
368
+ * ```ts
369
+ * editor.getData(); // -> '<p>This is editor!</p>'
370
+ * ```
371
+ *
372
+ * If your editor implementation uses multiple roots, you should pass root name as one of the options:
373
+ *
374
+ * ```ts
375
+ * editor.getData( { rootName: 'header' } ); // -> '<p>Content for header part.</p>'
376
+ * ```
377
+ *
378
+ * By default, the editor outputs HTML. This can be controlled by injecting a different data processor.
379
+ * See the {@glink features/markdown Markdown output} guide for more details.
380
+ *
381
+ * A warning is logged when you try to retrieve data for a detached root, as most probably this is a mistake. A detached root should
382
+ * be treated like it is removed, and you should not save its data. Note, that the detached root data is always an empty string.
383
+ *
384
+ * @param options Additional configuration for the retrieved data.
385
+ * Editor features may introduce more configuration options that can be set through this parameter.
386
+ * @param options.rootName Root name. Defaults to `'main'`.
387
+ * @param options.trim Whether returned data should be trimmed. This option is set to `'empty'` by default,
388
+ * which means that whenever editor content is considered empty, an empty string is returned. To turn off trimming
389
+ * use `'none'`. In such cases exact content will be returned (for example `'<p>&nbsp;</p>'` for an empty editor).
390
+ * @returns Output data.
391
+ */
392
+ getData(options?: {
393
+ rootName?: string;
394
+ trim?: "empty" | "none";
395
+ [key: string]: unknown;
396
+ }): string;
397
+ /**
398
+ * Loads and initializes plugins specified in the configuration.
399
+ *
400
+ * @returns A promise which resolves once the initialization is completed, providing an array of loaded plugins.
401
+ */
402
+ initPlugins(): Promise<LoadedPlugins>;
403
+ /**
404
+ * Destroys the editor instance, releasing all resources used by it.
405
+ *
406
+ * **Note** The editor cannot be destroyed during the initialization phase so if it is called
407
+ * while the editor {@link #state is being initialized}, it will wait for the editor initialization before destroying it.
408
+ *
409
+ * @fires destroy
410
+ * @returns A promise that resolves once the editor instance is fully destroyed.
411
+ */
412
+ destroy(): Promise<unknown>;
413
+ /**
414
+ * Executes the specified command with given parameters.
415
+ *
416
+ * Shorthand for:
417
+ *
418
+ * ```ts
419
+ * editor.commands.get( commandName ).execute( ... );
420
+ * ```
421
+ *
422
+ * @param commandName The name of the command to execute.
423
+ * @param commandParams Command parameters.
424
+ * @returns The value returned by the {@link module:core/commandcollection~CommandCollection#execute `commands.execute()`}.
425
+ */
426
+ execute<TName extends string>(commandName: TName, ...commandParams: Parameters<CommandsMap[TName]["execute"]>): ReturnType<CommandsMap[TName]["execute"]>;
427
+ /**
428
+ * Focuses the editor.
429
+ *
430
+ * **Note** To explicitly focus the editing area of the editor, use the
431
+ * {@link module:engine/view/view~EditingView#focus `editor.editing.view.focus()`} method of the editing view.
432
+ *
433
+ * Check out the {@glink framework/deep-dive/ui/focus-tracking#focus-in-the-editor-ui Focus in the editor UI} section
434
+ * of the {@glink framework/deep-dive/ui/focus-tracking Deep dive into focus tracking} guide to learn more.
435
+ */
436
+ focus(): void;
437
+ /**
438
+ * Registers a given string as a root attribute key. Registered root attributes are added to
439
+ * the {@link module:engine/model/schema~ModelSchema schema}.
440
+ *
441
+ * **Note:** Attributes passed in the configuration for multi-root editors
442
+ * ({@link module:core/editor/editorconfig~EditorConfig#roots `config.roots.<rootName>.modelAttributes`}) or
443
+ * single-root editors ({@link module:core/editor/editorconfig~EditorConfig#root `config.root.modelAttributes`})
444
+ * are automatically registered when the editor is initialized. However, registering the same attribute twice
445
+ * does not have any negative impact, so it is recommended to use this method in any feature that uses
446
+ * root attributes.
447
+ *
448
+ * **Note:** Registered attributes are attached only to the generic `$root` schema element. A custom root
449
+ * {@link module:core/editor/editorconfig~RootConfig#modelElement `modelElement`} must opt into the `$root`
450
+ * attribute chain via `allowAttributesOf: '$root'` to inherit these attributes.
451
+ * See the {@glink framework/deep-dive/schema#custom-root-elements Custom root elements} section of the
452
+ * {@glink framework/deep-dive/schema Schema deep-dive} guide for more details.
453
+ */
454
+ registerRootAttribute(key: string): void;
455
+ /**
456
+ * Returns attributes for the specified root.
457
+ * If no root name is provided, it returns attributes for the 'main' root by default.
458
+ *
459
+ * Note: all and only {@link ~Editor#registerRootAttribute registered} roots attributes will be returned.
460
+ * If a registered root attribute is not set for a given root, `null` will be returned.
461
+ */
462
+ getRootAttributes(rootName?: string): EditorRootAttributes;
463
+ /**
464
+ * Creates and initializes a new editor instance.
465
+ *
466
+ * This is an abstract method. Every editor type needs to implement its own initialization logic.
467
+ *
468
+ * See the `create()` methods of the existing editor types to learn how to use them:
469
+ *
470
+ * * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}
471
+ * * {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}
472
+ * * {@link module:editor-decoupled/decouplededitor~DecoupledEditor.create `DecoupledEditor.create()`}
473
+ * * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}
474
+ */
475
+ static create(...args: Array<unknown>): void;
476
+ /**
477
+ * The {@link module:core/context~Context} class.
478
+ *
479
+ * Exposed as static editor field for easier access in editor builds.
480
+ */
481
+ static Context: typeof Context;
482
+ /**
483
+ * The {@link module:watchdog/editorwatchdog~EditorWatchdog} class.
484
+ *
485
+ * Exposed as static editor field for easier access in editor builds.
486
+ */
487
+ static EditorWatchdog: typeof EditorWatchdog;
488
+ /**
489
+ * The {@link module:watchdog/contextwatchdog~ContextWatchdog} class.
490
+ *
491
+ * Exposed as static editor field for easier access in editor builds.
492
+ */
493
+ static ContextWatchdog: typeof ContextWatchdog;
494
+ protected _showLicenseError(reason: LicenseErrorReason, name?: string): void;
495
+ /**
496
+ * This part of the code is _not_ executed in installations under the GPL license (with `config.licenseKey = 'GPL'`).
497
+ *
498
+ * It is only executed when a specific license key is provided. If you are uncertain whether
499
+ * this applies to your installation, please contact our support team.
500
+ */
501
+ private _sendUsageRequest;
505
502
  }
506
503
  /**
507
- * @internal
508
- */
509
- export type LicenseErrorReason = 'invalid' | 'expired' | 'domainLimit' | 'pluginNotAllowed' | 'featureNotAllowed' | 'evaluationLimit' | 'trialLimit' | 'developmentLimit' | 'usageLimit' | 'distributionChannel';
504
+ * @internal
505
+ */
506
+ export type LicenseErrorReason = "invalid" | "expired" | "domainLimit" | "pluginNotAllowed" | "featureNotAllowed" | "evaluationLimit" | "trialLimit" | "developmentLimit" | "usageLimit" | "distributionChannel";
510
507
  /**
511
- * Fired when the {@link module:engine/controller/datacontroller~DataController#event:ready data} and all additional
512
- * editor components are ready.
513
- *
514
- * Note: This event is most useful for plugin developers. When integrating the editor with your website or
515
- * application, you do not have to listen to `editor#ready` because when the promise returned by the static
516
- * {@link module:core/editor/editor~Editor.create `Editor.create()`} event is resolved, the editor is already ready.
517
- * In fact, since the first moment when the editor instance is available to you is inside `then()`'s callback,
518
- * you cannot even add a listener to the `editor#ready` event.
519
- *
520
- * See also the {@link module:core/editor/editor~Editor#state `editor.state`} property.
521
- *
522
- * @eventName ~Editor#ready
523
- */
508
+ * Fired when the {@link module:engine/controller/datacontroller~DataController#event:ready data} and all additional
509
+ * editor components are ready.
510
+ *
511
+ * Note: This event is most useful for plugin developers. When integrating the editor with your website or
512
+ * application, you do not have to listen to `editor#ready` because when the promise returned by the static
513
+ * {@link module:core/editor/editor~Editor.create `Editor.create()`} event is resolved, the editor is already ready.
514
+ * In fact, since the first moment when the editor instance is available to you is inside `then()`'s callback,
515
+ * you cannot even add a listener to the `editor#ready` event.
516
+ *
517
+ * See also the {@link module:core/editor/editor~Editor#state `editor.state`} property.
518
+ *
519
+ * @eventName ~Editor#ready
520
+ */
524
521
  export type EditorReadyEvent = {
525
- name: 'ready';
526
- args: [];
522
+ name: "ready";
523
+ args: [];
527
524
  };
528
525
  /**
529
- * Fired when the editor is about to collect usage data.
530
- *
531
- * This event is fired when the editor is about to collect usage data. It allows plugins to provide additional data for
532
- * the usage statistics. The usage data is collected by the editor and sent to the usage tracking server. All plugins are
533
- * expected to be ready at this point.
534
- *
535
- * @eventName ~Editor#collectUsageData
536
- */
526
+ * Fired when the editor is about to collect usage data.
527
+ *
528
+ * This event is fired when the editor is about to collect usage data. It allows plugins to provide additional data for
529
+ * the usage statistics. The usage data is collected by the editor and sent to the usage tracking server. All plugins are
530
+ * expected to be ready at this point.
531
+ *
532
+ * @eventName ~Editor#collectUsageData
533
+ */
537
534
  export type EditorCollectUsageDataEvent = {
538
- name: 'collectUsageData';
539
- args: [
540
- {
541
- setUsageData(path: string, value: unknown): void;
542
- }
543
- ];
535
+ name: "collectUsageData";
536
+ args: [{
537
+ setUsageData(path: string, value: unknown): void;
538
+ }];
544
539
  };
545
540
  /**
546
- * Fired when this editor instance is destroyed. The editor at this point is not usable and this event should be used to
547
- * perform the clean-up in any plugin.
548
- *
549
- * See also the {@link module:core/editor/editor~Editor#state `editor.state`} property.
550
- *
551
- * @eventName ~Editor#destroy
552
- */
541
+ * Fired when this editor instance is destroyed. The editor at this point is not usable and this event should be used to
542
+ * perform the clean-up in any plugin.
543
+ *
544
+ * See also the {@link module:core/editor/editor~Editor#state `editor.state`} property.
545
+ *
546
+ * @eventName ~Editor#destroy
547
+ */
553
548
  export type EditorDestroyEvent = {
554
- name: 'destroy';
555
- args: [];
549
+ name: "destroy";
550
+ args: [];
556
551
  };
557
552
  /**
558
- * Attributes set on a model root element.
559
- */
553
+ * Attributes set on a model root element.
554
+ */
560
555
  export type EditorRootAttributes = Record<string, unknown>;
561
556
  export {};
562
- /**
563
- * This error is thrown when trying to pass a `<textarea>` element to a `create()` function of an editor class.
564
- *
565
- * The only editor type which can be initialized on `<textarea>` elements is
566
- * the {@glink getting-started/setup/editor-types#classic-editor classic editor}.
567
- * This editor hides the passed element and inserts its own UI next to it. Other types of editors reuse the passed element as their root
568
- * editable element and therefore `<textarea>` is not appropriate for them. Use a `<div>` or another text container instead:
569
- *
570
- * ```html
571
- * <div id="editor">
572
- * <p>Initial content.</p>
573
- * </div>
574
- * ```
575
- *
576
- * @error editor-wrong-element
577
- */
578
- /**
579
- * You are running [CKEditor 5 Long-term Support Edition (LTS)](https://ckeditor.com/ckeditor-5-lts/),
580
- * but the provided license key does not include access to the LTS version, or the key is invalid.
581
- *
582
- * Please ensure that it is copied correctly from the [Customer Portal](http://portal.ckeditor.com/),
583
- * and if the issue persists, please [contact our customer support](https://ckeditor.com/contact/).
584
- *
585
- * In case you intended to use the [LTS Edition](https://ckeditor.com/ckeditor-5-lts/),
586
- * but have not yet made a purchase, please [contact our sales team](https://ckeditor.com/contact-sales/)
587
- *
588
- * If you did not intend to use LTS, please note that all releases in the v47.7 line are
589
- * for LTS subscribers only. To use a non-LTS edition, either upgrade to v48 or newer,
590
- * which is our standard [latest](https://ckeditor.com/docs/ckeditor5/latest/updating/guides/changelog.html)
591
- * release line, or stay on a version 47.6.2 or earlier.
592
- *
593
- * @error license-key-lts-not-allowed
594
- */