@ckeditor/ckeditor5-core 47.6.1 → 48.0.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 (122) hide show
  1. package/LICENSE.md +1 -1
  2. package/{src → dist}/editor/editorconfig.d.ts +295 -20
  3. package/dist/editor/utils/normalizerootsconfig.d.ts +50 -0
  4. package/dist/index-content.css +10 -10
  5. package/dist/index-editor.css +5 -5
  6. package/dist/index.css +10 -16
  7. package/dist/index.css.map +1 -1
  8. package/{src → dist}/index.d.ts +2 -1
  9. package/dist/index.js +161 -6
  10. package/dist/index.js.map +1 -1
  11. package/package.json +23 -43
  12. package/lang/contexts.json +0 -38
  13. package/lang/translations/af.po +0 -156
  14. package/lang/translations/ar.po +0 -156
  15. package/lang/translations/ast.po +0 -156
  16. package/lang/translations/az.po +0 -156
  17. package/lang/translations/be.po +0 -156
  18. package/lang/translations/bg.po +0 -156
  19. package/lang/translations/bn.po +0 -156
  20. package/lang/translations/bs.po +0 -156
  21. package/lang/translations/ca.po +0 -156
  22. package/lang/translations/cs.po +0 -156
  23. package/lang/translations/da.po +0 -156
  24. package/lang/translations/de-ch.po +0 -156
  25. package/lang/translations/de.po +0 -156
  26. package/lang/translations/el.po +0 -156
  27. package/lang/translations/en-au.po +0 -156
  28. package/lang/translations/en-gb.po +0 -156
  29. package/lang/translations/en.po +0 -156
  30. package/lang/translations/eo.po +0 -156
  31. package/lang/translations/es-co.po +0 -156
  32. package/lang/translations/es.po +0 -156
  33. package/lang/translations/et.po +0 -156
  34. package/lang/translations/eu.po +0 -156
  35. package/lang/translations/fa.po +0 -156
  36. package/lang/translations/fi.po +0 -156
  37. package/lang/translations/fr.po +0 -156
  38. package/lang/translations/gl.po +0 -156
  39. package/lang/translations/gu.po +0 -156
  40. package/lang/translations/he.po +0 -156
  41. package/lang/translations/hi.po +0 -156
  42. package/lang/translations/hr.po +0 -156
  43. package/lang/translations/hu.po +0 -156
  44. package/lang/translations/hy.po +0 -156
  45. package/lang/translations/id.po +0 -156
  46. package/lang/translations/it.po +0 -156
  47. package/lang/translations/ja.po +0 -156
  48. package/lang/translations/jv.po +0 -156
  49. package/lang/translations/kk.po +0 -156
  50. package/lang/translations/km.po +0 -156
  51. package/lang/translations/kn.po +0 -156
  52. package/lang/translations/ko.po +0 -156
  53. package/lang/translations/ku.po +0 -156
  54. package/lang/translations/lt.po +0 -156
  55. package/lang/translations/lv.po +0 -156
  56. package/lang/translations/ms.po +0 -156
  57. package/lang/translations/nb.po +0 -156
  58. package/lang/translations/ne.po +0 -156
  59. package/lang/translations/nl.po +0 -156
  60. package/lang/translations/no.po +0 -156
  61. package/lang/translations/oc.po +0 -156
  62. package/lang/translations/pl.po +0 -156
  63. package/lang/translations/pt-br.po +0 -156
  64. package/lang/translations/pt.po +0 -156
  65. package/lang/translations/ro.po +0 -156
  66. package/lang/translations/ru.po +0 -156
  67. package/lang/translations/si.po +0 -156
  68. package/lang/translations/sk.po +0 -156
  69. package/lang/translations/sl.po +0 -156
  70. package/lang/translations/sq.po +0 -156
  71. package/lang/translations/sr-latn.po +0 -156
  72. package/lang/translations/sr.po +0 -156
  73. package/lang/translations/sv.po +0 -156
  74. package/lang/translations/th.po +0 -156
  75. package/lang/translations/ti.po +0 -156
  76. package/lang/translations/tk.po +0 -156
  77. package/lang/translations/tr.po +0 -156
  78. package/lang/translations/tt.po +0 -156
  79. package/lang/translations/ug.po +0 -156
  80. package/lang/translations/uk.po +0 -156
  81. package/lang/translations/ur.po +0 -156
  82. package/lang/translations/uz.po +0 -156
  83. package/lang/translations/vi.po +0 -156
  84. package/lang/translations/zh-cn.po +0 -156
  85. package/lang/translations/zh.po +0 -156
  86. package/src/accessibility.js +0 -332
  87. package/src/augmentation.js +0 -5
  88. package/src/command.js +0 -221
  89. package/src/commandcollection.js +0 -87
  90. package/src/context.js +0 -315
  91. package/src/contextplugin.js +0 -59
  92. package/src/editingkeystrokehandler.js +0 -61
  93. package/src/editor/editor.js +0 -1010
  94. package/src/editor/editorconfig.js +0 -5
  95. package/src/editor/utils/attachtoform.js +0 -57
  96. package/src/editor/utils/editorusagedata.js +0 -127
  97. package/src/editor/utils/elementapimixin.js +0 -42
  98. package/src/editor/utils/securesourceelement.js +0 -35
  99. package/src/index.js +0 -22
  100. package/src/multicommand.js +0 -79
  101. package/src/pendingactions.js +0 -127
  102. package/src/plugin.js +0 -132
  103. package/src/plugincollection.js +0 -506
  104. package/src/typings.js +0 -5
  105. package/theme/core.css +0 -21
  106. /package/{src → dist}/accessibility.d.ts +0 -0
  107. /package/{src → dist}/augmentation.d.ts +0 -0
  108. /package/{src → dist}/command.d.ts +0 -0
  109. /package/{src → dist}/commandcollection.d.ts +0 -0
  110. /package/{src → dist}/context.d.ts +0 -0
  111. /package/{src → dist}/contextplugin.d.ts +0 -0
  112. /package/{src → dist}/editingkeystrokehandler.d.ts +0 -0
  113. /package/{src → dist}/editor/editor.d.ts +0 -0
  114. /package/{src → dist}/editor/utils/attachtoform.d.ts +0 -0
  115. /package/{src → dist}/editor/utils/editorusagedata.d.ts +0 -0
  116. /package/{src → dist}/editor/utils/elementapimixin.d.ts +0 -0
  117. /package/{src → dist}/editor/utils/securesourceelement.d.ts +0 -0
  118. /package/{src → dist}/multicommand.d.ts +0 -0
  119. /package/{src → dist}/pendingactions.d.ts +0 -0
  120. /package/{src → dist}/plugin.d.ts +0 -0
  121. /package/{src → dist}/plugincollection.d.ts +0 -0
  122. /package/{src → dist}/typings.d.ts +0 -0
@@ -1,506 +0,0 @@
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
- /**
6
- * @module core/plugincollection
7
- */
8
- import { CKEditorError, EmitterMixin } from '@ckeditor/ckeditor5-utils';
9
- /**
10
- * Manages a list of CKEditor plugins, including loading, resolving dependencies and initialization.
11
- */
12
- export class PluginCollection extends /* #__PURE__ */ EmitterMixin() {
13
- _context;
14
- _plugins = new Map();
15
- /**
16
- * A map of plugin constructors that can be retrieved by their names.
17
- */
18
- _availablePlugins;
19
- /**
20
- * Map of {@link module:core/contextplugin~ContextPlugin context plugins} which can be retrieved by their constructors or instances.
21
- */
22
- _contextPlugins;
23
- /**
24
- * Creates an instance of the plugin collection class.
25
- * Allows loading and initializing plugins and their dependencies.
26
- * Allows providing a list of already loaded plugins. These plugins will not be destroyed along with this collection.
27
- *
28
- * @param availablePlugins Plugins (constructors) which the collection will be able to use
29
- * when {@link module:core/plugincollection~PluginCollection#init} is used with the plugin names (strings, instead of constructors).
30
- * Usually, the editor will pass its built-in plugins to the collection so they can later be
31
- * used in `config.plugins` or `config.removePlugins` by names.
32
- * @param contextPlugins A list of already initialized plugins represented by a `[ PluginConstructor, pluginInstance ]` pair.
33
- */
34
- constructor(context, availablePlugins = [], contextPlugins = []) {
35
- super();
36
- this._context = context;
37
- this._availablePlugins = new Map();
38
- for (const PluginConstructor of availablePlugins) {
39
- if (PluginConstructor.pluginName) {
40
- this._availablePlugins.set(PluginConstructor.pluginName, PluginConstructor);
41
- }
42
- }
43
- this._contextPlugins = new Map();
44
- for (const [PluginConstructor, pluginInstance] of contextPlugins) {
45
- this._contextPlugins.set(PluginConstructor, pluginInstance);
46
- this._contextPlugins.set(pluginInstance, PluginConstructor);
47
- // To make it possible to require a plugin by its name.
48
- if (PluginConstructor.pluginName) {
49
- this._availablePlugins.set(PluginConstructor.pluginName, PluginConstructor);
50
- }
51
- }
52
- }
53
- /**
54
- * Iterable interface.
55
- *
56
- * Returns `[ PluginConstructor, pluginInstance ]` pairs.
57
- */
58
- *[Symbol.iterator]() {
59
- for (const entry of this._plugins) {
60
- if (typeof entry[0] == 'function') {
61
- yield entry;
62
- }
63
- }
64
- }
65
- /**
66
- * Gets the plugin instance by its constructor or name.
67
- *
68
- * ```ts
69
- * // Check if 'Clipboard' plugin was loaded.
70
- * if ( editor.plugins.has( 'ClipboardPipeline' ) ) {
71
- * // Get clipboard plugin instance
72
- * const clipboard = editor.plugins.get( 'ClipboardPipeline' );
73
- *
74
- * this.listenTo( clipboard, 'inputTransformation', ( evt, data ) => {
75
- * // Do something on clipboard input.
76
- * } );
77
- * }
78
- * ```
79
- *
80
- * **Note**: This method will throw an error if a plugin is not loaded. Use `{@link #has editor.plugins.has()}`
81
- * to check if a plugin is available.
82
- *
83
- * @param key The plugin constructor or {@link module:core/plugin~PluginStaticMembers#pluginName name}.
84
- */
85
- get(key) {
86
- const plugin = this._plugins.get(key);
87
- if (!plugin) {
88
- let pluginName = key;
89
- if (typeof key == 'function') {
90
- pluginName = key.pluginName || key.name;
91
- }
92
- /**
93
- * The plugin is not loaded and could not be obtained.
94
- *
95
- * Plugin classes (constructors) need to be provided to the editor and must be loaded before they can be obtained from
96
- * the plugin collection.
97
- *
98
- * **Note**: You can use `{@link module:core/plugincollection~PluginCollection#has editor.plugins.has()}`
99
- * to check if a plugin was loaded.
100
- *
101
- * @error plugincollection-plugin-not-loaded
102
- * @param {string} plugin The name of the plugin which is not loaded.
103
- */
104
- throw new CKEditorError('plugincollection-plugin-not-loaded', this._context, { plugin: pluginName });
105
- }
106
- return plugin;
107
- }
108
- /**
109
- * Checks if a plugin is loaded.
110
- *
111
- * ```ts
112
- * // Check if the 'Clipboard' plugin was loaded.
113
- * if ( editor.plugins.has( 'ClipboardPipeline' ) ) {
114
- * // Now use the clipboard plugin instance:
115
- * const clipboard = editor.plugins.get( 'ClipboardPipeline' );
116
- *
117
- * // ...
118
- * }
119
- * ```
120
- *
121
- * @param key The plugin constructor or {@link module:core/plugin~PluginStaticMembers#pluginName name}.
122
- */
123
- has(key) {
124
- return this._plugins.has(key);
125
- }
126
- /**
127
- * Initializes a set of plugins and adds them to the collection.
128
- *
129
- * @param plugins An array of {@link module:core/plugin~PluginInterface plugin constructors}
130
- * or {@link module:core/plugin~PluginStaticMembers#pluginName plugin names}.
131
- * @param pluginsToRemove Names of the plugins or plugin constructors
132
- * that should not be loaded (despite being specified in the `plugins` array).
133
- * @param pluginsSubstitutions An array of {@link module:core/plugin~PluginInterface plugin constructors}
134
- * that will be used to replace plugins of the same names that were passed in `plugins` or that are in their dependency tree.
135
- * A useful option for replacing built-in plugins while creating tests (for mocking their APIs). Plugins that will be replaced
136
- * must follow these rules:
137
- * * The new plugin must be a class.
138
- * * The new plugin must be named.
139
- * * Both plugins must not depend on other plugins.
140
- * @returns A promise which gets resolved once all plugins are loaded and available in the collection.
141
- */
142
- async init(plugins, pluginsToRemove = [], pluginsSubstitutions = []) {
143
- // Plugin initialization procedure consists of 2 main steps:
144
- // 1) collecting all available plugin constructors,
145
- // 2) verification whether all required plugins can be instantiated.
146
- //
147
- // In the first step, all plugin constructors, available in the provided `plugins` array and inside
148
- // plugin's dependencies (from the `Plugin.requires` array), are recursively collected and added to the existing
149
- // `this._availablePlugins` map, but without any verification at the given moment. Performing the verification
150
- // at this point (during the plugin constructor searching) would cause false errors to occur, that some plugin
151
- // is missing but in fact it may be defined further in the array as the dependency of other plugin. After
152
- // traversing the entire dependency tree, it will be checked if all required "top level" plugins are available.
153
- //
154
- // In the second step, the list of plugins that have not been explicitly removed is traversed to get all the
155
- // plugin constructors to be instantiated in the correct order and to validate against some rules. Finally, if
156
- // no plugin is missing and no other error has been found, they all will be instantiated.
157
- // eslint-disable-next-line @typescript-eslint/no-this-alias
158
- const that = this;
159
- const context = this._context;
160
- findAvailablePluginConstructors(plugins);
161
- validatePlugins(plugins);
162
- const pluginsToLoad = plugins.filter(plugin => !isPluginRemoved(plugin, pluginsToRemove));
163
- const pluginConstructors = [...getPluginConstructors(pluginsToLoad)];
164
- substitutePlugins(pluginConstructors, pluginsSubstitutions);
165
- const pluginInstances = loadPlugins(pluginConstructors);
166
- await initPlugins(pluginInstances, 'init');
167
- await initPlugins(pluginInstances, 'afterInit');
168
- return pluginInstances;
169
- function isPluginConstructor(plugin) {
170
- return typeof plugin === 'function';
171
- }
172
- function isContextPlugin(plugin) {
173
- return isPluginConstructor(plugin) && !!plugin.isContextPlugin;
174
- }
175
- function isPluginRemoved(plugin, pluginsToRemove) {
176
- return pluginsToRemove.some(removedPlugin => {
177
- if (removedPlugin === plugin) {
178
- return true;
179
- }
180
- if (getPluginName(plugin) === removedPlugin) {
181
- return true;
182
- }
183
- if (getPluginName(removedPlugin) === plugin) {
184
- return true;
185
- }
186
- return false;
187
- });
188
- }
189
- function getPluginName(plugin) {
190
- return isPluginConstructor(plugin) ?
191
- plugin.pluginName || plugin.name :
192
- plugin;
193
- }
194
- function findAvailablePluginConstructors(plugins, processed = new Set()) {
195
- plugins.forEach(plugin => {
196
- if (!isPluginConstructor(plugin)) {
197
- return;
198
- }
199
- if (processed.has(plugin)) {
200
- return;
201
- }
202
- processed.add(plugin);
203
- if (plugin.pluginName && !that._availablePlugins.has(plugin.pluginName)) {
204
- that._availablePlugins.set(plugin.pluginName, plugin);
205
- }
206
- if (plugin.requires) {
207
- findAvailablePluginConstructors(plugin.requires, processed);
208
- }
209
- });
210
- }
211
- function getPluginConstructors(plugins, processed = new Set()) {
212
- return plugins
213
- .map(plugin => {
214
- return isPluginConstructor(plugin) ?
215
- plugin :
216
- that._availablePlugins.get(plugin);
217
- })
218
- .reduce((result, plugin) => {
219
- if (processed.has(plugin)) {
220
- return result;
221
- }
222
- processed.add(plugin);
223
- if (plugin.requires) {
224
- validatePlugins(plugin.requires, plugin);
225
- getPluginConstructors(plugin.requires, processed).forEach(plugin => result.add(plugin));
226
- }
227
- return result.add(plugin);
228
- }, new Set());
229
- }
230
- function validatePlugins(plugins, parentPluginConstructor = null) {
231
- plugins
232
- .map(plugin => {
233
- return isPluginConstructor(plugin) ?
234
- plugin :
235
- that._availablePlugins.get(plugin) || plugin;
236
- })
237
- .forEach(plugin => {
238
- checkPluginConstructor(plugin);
239
- checkMissingPlugin(plugin, parentPluginConstructor);
240
- checkContextPlugin(plugin, parentPluginConstructor);
241
- checkRemovedPlugin(plugin, parentPluginConstructor);
242
- });
243
- }
244
- function checkPluginConstructor(plugin) {
245
- if (typeof plugin !== 'function') {
246
- return;
247
- }
248
- if (plugin._throwErrorWhenUsedAsAPlugin) {
249
- /**
250
- * The provided class constructor is not a plugin.
251
- *
252
- * This error is usually caused by passing an editor, context, or command
253
- * constructor in the `config.plugins` array.
254
- *
255
- * @param {String} name The name of the provided constructor.
256
- * @error plugincollection-plugin-invalid-constructor
257
- */
258
- throw new CKEditorError('plugincollection-plugin-invalid-constructor', context, { name: plugin.name });
259
- }
260
- }
261
- function checkMissingPlugin(plugin, parentPluginConstructor) {
262
- if (isPluginConstructor(plugin)) {
263
- return;
264
- }
265
- if (parentPluginConstructor) {
266
- /**
267
- * A required "soft" dependency was not found on the plugin list.
268
- *
269
- * When configuring the editor, either prior to building (via
270
- * {@link module:core/editor/editor~Editor.builtinPlugins `Editor.builtinPlugins`}) or when
271
- * creating a new instance of the editor (e.g. via
272
- * {@link module:core/editor/editorconfig~EditorConfig#plugins `config.plugins`}), you need to provide
273
- * some of the dependencies for other plugins that you used.
274
- *
275
- * This error is thrown when one of these dependencies was not provided. The name of the missing plugin
276
- * can be found in `missingPlugin` and the plugin that required it in `requiredBy`.
277
- *
278
- * In order to resolve it, you need to import the missing plugin and add it to the
279
- * current list of plugins (`Editor.builtinPlugins` or `config.plugins`/`config.extraPlugins`).
280
- *
281
- * Soft requirements were introduced in version 26.0.0. If you happen to stumble upon this error
282
- * when upgrading to version 26.0.0, read also the
283
- * {@glink updating/guides/update-to-26 Migration to 26.0.0} guide.
284
- *
285
- * @error plugincollection-soft-required
286
- * @param {string} missingPlugin The name of the required plugin.
287
- * @param {string} requiredBy The name of the plugin that requires the other plugin.
288
- */
289
- throw new CKEditorError('plugincollection-soft-required', context, { missingPlugin: plugin, requiredBy: getPluginName(parentPluginConstructor) });
290
- }
291
- /**
292
- * A plugin is not available and could not be loaded.
293
- *
294
- * Plugin classes (constructors) need to be provided to the editor before they can be loaded by name.
295
- * This is usually done in the now deprecated CKEditor 5 builds by setting
296
- * the {@link module:core/editor/editor~Editor.builtinPlugins} property.
297
- *
298
- * **If you see this warning when using one of the deprecated CKEditor 5 Builds**,
299
- * it means that you tried to enable a plugin that was not included in that build. This may be due to a typo
300
- * in the plugin name or simply because that plugin was not a part of this build.
301
- *
302
- * **Predefined builds are no longer supported and you need to
303
- * {@glink updating/nim-migration/migration-to-new-installation-methods migrate to new installation methods}**.
304
- *
305
- * **If you see this warning when using one of the editor creators directly** (not a build), then it means
306
- * that you tried loading plugins by name. However, unlike CKEditor 4, CKEditor 5 does not implement a "plugin loader".
307
- * This means that CKEditor 5 does not know where to load the plugin modules from. Therefore, you need to
308
- * provide each plugin through a reference (as a constructor function). Check out the examples in the
309
- * {@glink getting-started/installation/cloud/quick-start Quick start} guide.
310
- *
311
- * @error plugincollection-plugin-not-found
312
- * @param {string} plugin The name of the plugin which could not be loaded.
313
- */
314
- throw new CKEditorError('plugincollection-plugin-not-found', context, { plugin });
315
- }
316
- function checkContextPlugin(plugin, parentPluginConstructor) {
317
- if (!isContextPlugin(parentPluginConstructor)) {
318
- return;
319
- }
320
- if (isContextPlugin(plugin)) {
321
- return;
322
- }
323
- /**
324
- * If a plugin is a context plugin, all plugins it requires should also be context plugins
325
- * instead of plugins. In other words, if one plugin can be used in the context,
326
- * all its requirements should also be ready to be used in the context. Note that the context
327
- * provides only a part of the API provided by the editor. If one plugin needs a full
328
- * editor API, all plugins which require it are considered as plugins that need a full
329
- * editor API.
330
- *
331
- * @error plugincollection-context-required
332
- * @param {string} plugin The name of the required plugin.
333
- * @param {string} requiredBy The name of the parent plugin.
334
- */
335
- throw new CKEditorError('plugincollection-context-required', context, { plugin: getPluginName(plugin), requiredBy: getPluginName(parentPluginConstructor) });
336
- }
337
- function checkRemovedPlugin(plugin, parentPluginConstructor) {
338
- if (!parentPluginConstructor) {
339
- return;
340
- }
341
- if (!isPluginRemoved(plugin, pluginsToRemove)) {
342
- return;
343
- }
344
- /**
345
- * Cannot load a plugin because one of its dependencies is listed in the `removePlugins` option.
346
- *
347
- * @error plugincollection-required
348
- * @param {string} plugin The name of the required plugin.
349
- * @param {string} requiredBy The name of the parent plugin.
350
- */
351
- throw new CKEditorError('plugincollection-required', context, { plugin: getPluginName(plugin), requiredBy: getPluginName(parentPluginConstructor) });
352
- }
353
- function loadPlugins(pluginConstructors) {
354
- return pluginConstructors.map(PluginConstructor => {
355
- let pluginInstance = that._contextPlugins.get(PluginConstructor);
356
- pluginInstance = pluginInstance || new PluginConstructor(context);
357
- that._add(PluginConstructor, pluginInstance);
358
- return pluginInstance;
359
- });
360
- }
361
- function initPlugins(pluginInstances, method) {
362
- return pluginInstances.reduce((promise, plugin) => {
363
- if (!plugin[method]) {
364
- return promise;
365
- }
366
- if (that._contextPlugins.has(plugin)) {
367
- return promise;
368
- }
369
- return promise.then(plugin[method].bind(plugin));
370
- }, Promise.resolve());
371
- }
372
- /**
373
- * Replaces plugin constructors with the specified set of plugins.
374
- */
375
- function substitutePlugins(pluginConstructors, pluginsSubstitutions) {
376
- for (const pluginItem of pluginsSubstitutions) {
377
- if (typeof pluginItem != 'function') {
378
- /**
379
- * The plugin replacing an existing plugin must be a function.
380
- *
381
- * @error plugincollection-replace-plugin-invalid-type
382
- * @param {never} pluginItem The plugin item.
383
- */
384
- throw new CKEditorError('plugincollection-replace-plugin-invalid-type', null, { pluginItem });
385
- }
386
- const pluginName = pluginItem.pluginName;
387
- if (!pluginName) {
388
- /**
389
- * The plugin replacing an existing plugin must have a name.
390
- *
391
- * @error plugincollection-replace-plugin-missing-name
392
- * @param {module:core/plugin~PluginConstructor} pluginItem The plugin item.
393
- */
394
- throw new CKEditorError('plugincollection-replace-plugin-missing-name', null, { pluginItem });
395
- }
396
- if (pluginItem.requires && pluginItem.requires.length) {
397
- /**
398
- * The plugin replacing an existing plugin cannot depend on other plugins.
399
- *
400
- * @error plugincollection-plugin-for-replacing-cannot-have-dependencies
401
- * @param {string} pluginName The name of the plugin.
402
- */
403
- throw new CKEditorError('plugincollection-plugin-for-replacing-cannot-have-dependencies', null, { pluginName });
404
- }
405
- const pluginToReplace = that._availablePlugins.get(pluginName);
406
- if (!pluginToReplace) {
407
- /**
408
- * The replaced plugin does not exist in the
409
- * {@link module:core/plugincollection~PluginCollection available plugins} collection.
410
- *
411
- * @error plugincollection-plugin-for-replacing-not-exist
412
- * @param {string} pluginName The name of the plugin.
413
- */
414
- throw new CKEditorError('plugincollection-plugin-for-replacing-not-exist', null, { pluginName });
415
- }
416
- const indexInPluginConstructors = pluginConstructors.indexOf(pluginToReplace);
417
- if (indexInPluginConstructors === -1) {
418
- // The Context feature can substitute plugins as well.
419
- // It may happen that the editor will be created with the given context, where the plugin for substitute
420
- // was already replaced. In such a case, we don't want to do it again.
421
- if (that._contextPlugins.has(pluginToReplace)) {
422
- return;
423
- }
424
- /**
425
- * The replaced plugin will not be loaded so it cannot be replaced.
426
- *
427
- * @error plugincollection-plugin-for-replacing-not-loaded
428
- * @param {string} pluginName The name of the plugin.
429
- */
430
- throw new CKEditorError('plugincollection-plugin-for-replacing-not-loaded', null, { pluginName });
431
- }
432
- if (pluginToReplace.requires && pluginToReplace.requires.length) {
433
- /**
434
- * The replaced plugin cannot depend on other plugins.
435
- *
436
- * @error plugincollection-replaced-plugin-cannot-have-dependencies
437
- * @param {string} pluginName The name of the plugin.
438
- */
439
- throw new CKEditorError('plugincollection-replaced-plugin-cannot-have-dependencies', null, { pluginName });
440
- }
441
- pluginConstructors.splice(indexInPluginConstructors, 1, pluginItem);
442
- that._availablePlugins.set(pluginName, pluginItem);
443
- }
444
- }
445
- }
446
- /**
447
- * Destroys all loaded plugins.
448
- */
449
- destroy() {
450
- const promises = [];
451
- for (const [, pluginInstance] of this) {
452
- if (typeof pluginInstance.destroy == 'function' && !this._contextPlugins.has(pluginInstance)) {
453
- promises.push(pluginInstance.destroy());
454
- }
455
- }
456
- return Promise.all(promises);
457
- }
458
- /**
459
- * Adds the plugin to the collection. Exposed mainly for testing purposes.
460
- *
461
- * @param PluginConstructor The plugin constructor.
462
- * @param plugin The instance of the plugin.
463
- */
464
- _add(PluginConstructor, plugin) {
465
- this._plugins.set(PluginConstructor, plugin);
466
- const pluginName = PluginConstructor.pluginName;
467
- if (!pluginName) {
468
- return;
469
- }
470
- if (this._plugins.has(pluginName)) {
471
- /**
472
- * Two plugins with the same {@link module:core/plugin~PluginStaticMembers#pluginName} were loaded.
473
- * This will lead to runtime conflicts between these plugins.
474
- *
475
- * In practice, this warning usually means that new plugins were added to an existing CKEditor 5 build.
476
- * Plugins should always be added to a source version of the editor (`@ckeditor/ckeditor5-editor-*`),
477
- * not to an editor imported from one of the `@ckeditor/ckeditor5-build-*` packages.
478
- *
479
- * Check your import paths and the list of plugins passed to
480
- * {@link module:core/editor/editor~Editor.create `Editor.create()`}
481
- * or specified in {@link module:core/editor/editor~Editor.builtinPlugins `Editor.builtinPlugins`}.
482
- *
483
- * Predefined builds are a deprecated solution and we strongly advise
484
- * {@glink updating/nim-migration/migration-to-new-installation-methods migrating to new installation methods}.
485
- *
486
- * The second option is that your `node_modules/` directory contains duplicated versions of the same
487
- * CKEditor 5 packages. Normally, on clean installations, npm deduplicates packages in `node_modules/`, so
488
- * it may be enough to call `rm -rf node_modules && npm i`. However, if you installed conflicting versions
489
- * of some packages, their dependencies may need to be installed in more than one version which may lead to this
490
- * warning.
491
- *
492
- * Technically speaking, this error occurs because after adding a plugin to an existing editor build
493
- * the dependencies of this plugin are being duplicated.
494
- * They are already built into that editor build and now get added for the second time as dependencies
495
- * of the plugin you are installing.
496
- *
497
- * @error plugincollection-plugin-name-conflict
498
- * @param {string} pluginName The duplicated plugin name.
499
- * @param {module:core/plugin~PluginConstructor} plugin1 The first plugin constructor.
500
- * @param {module:core/plugin~PluginConstructor} plugin2 The second plugin constructor.
501
- */
502
- throw new CKEditorError('plugincollection-plugin-name-conflict', null, { pluginName, plugin1: this._plugins.get(pluginName).constructor, plugin2: PluginConstructor });
503
- }
504
- this._plugins.set(pluginName, plugin);
505
- }
506
- }
package/src/typings.js DELETED
@@ -1,5 +0,0 @@
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
- export {};
package/theme/core.css DELETED
@@ -1,21 +0,0 @@
1
- /*
2
- * 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
-
6
- :root {
7
- --ck-content-font-family: Helvetica, Arial, Tahoma, Verdana, Sans-Serif;
8
- --ck-content-font-size: medium;
9
- /* stylelint-disable-next-line declaration-property-value-disallowed-list */
10
- --ck-content-font-color: #000;
11
- --ck-content-line-height: 1.5;
12
- --ck-content-word-break: break-word;
13
- }
14
-
15
- .ck-content {
16
- font-family: var(--ck-content-font-family);
17
- font-size: var(--ck-content-font-size);
18
- color: var(--ck-content-font-color);
19
- line-height: var(--ck-content-line-height);
20
- word-break: var(--ck-content-word-break);
21
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes