Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ckeditor/ckeditor5-core

Package Overview
Dependencies
Maintainers
1
Versions
717
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-core - npm Package Compare versions

Comparing version 36.0.1 to 37.0.0-alpha.0

src/command.d.ts

37

package.json
{
"name": "@ckeditor/ckeditor5-core",
"version": "36.0.1",
"version": "37.0.0-alpha.0",
"description": "The core architecture of CKEditor 5 – the best browser-based rich text editor.",

@@ -26,21 +26,21 @@ "keywords": [

"dependencies": {
"@ckeditor/ckeditor5-engine": "^36.0.1",
"@ckeditor/ckeditor5-utils": "^36.0.1",
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.0",
"lodash-es": "^4.17.15"
},
"devDependencies": {
"@ckeditor/ckeditor5-autoformat": "^36.0.1",
"@ckeditor/ckeditor5-basic-styles": "^36.0.1",
"@ckeditor/ckeditor5-block-quote": "^36.0.1",
"@ckeditor/ckeditor5-editor-classic": "^36.0.1",
"@ckeditor/ckeditor5-essentials": "^36.0.1",
"@ckeditor/ckeditor5-heading": "^36.0.1",
"@ckeditor/ckeditor5-image": "^36.0.1",
"@ckeditor/ckeditor5-indent": "^36.0.1",
"@ckeditor/ckeditor5-link": "^36.0.1",
"@ckeditor/ckeditor5-list": "^36.0.1",
"@ckeditor/ckeditor5-media-embed": "^36.0.1",
"@ckeditor/ckeditor5-paragraph": "^36.0.1",
"@ckeditor/ckeditor5-table": "^36.0.1",
"@ckeditor/ckeditor5-ui": "^36.0.1",
"@ckeditor/ckeditor5-autoformat": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-essentials": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-heading": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-image": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-indent": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-link": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-list": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-media-embed": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-table": "^37.0.0-alpha.0",
"@ckeditor/ckeditor5-ui": "^37.0.0-alpha.0",
"typescript": "^4.8.4",

@@ -74,3 +74,4 @@ "webpack": "^5.58.1",

"postversion": "npm run build"
}
},
"types": "src/index.d.ts"
}

@@ -13,3 +13,3 @@ CKEditor 5 core editor architecture

For general introduction see the [Overview of CKEditor 5 framework](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/overview.html) guide and then the [core editor architecture guide](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/architecture/core-editor-architecture.html).
For general introduction see the [Overview of CKEditor 5 framework](https://ckeditor.com/docs/ckeditor5/latest/framework/index.html) guide and then the [core editor architecture guide](https://ckeditor.com/docs/ckeditor5/latest/framework/architecture/core-editor-architecture.html).

@@ -16,0 +16,0 @@ Additionally, see the [`@ckeditor/ckeditor5-core` package](https://ckeditor.com/docs/ckeditor5/latest/api/core.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/) for even more information.

@@ -21,4 +21,2 @@ /**

* but commands with the {@link module:core/command~Command#affectsData `affectsData`} flag set to `false` will not be disabled.
*
* @mixes module:utils/observablemixin~ObservableMixin
*/

@@ -29,88 +27,10 @@ export default class Command extends ObservableMixin() {

*
* @param {module:core/editor/editor~Editor} editor The editor on which this command will be used.
* @param editor The editor on which this command will be used.
*/
constructor(editor) {
super();
/**
* The editor on which this command will be used.
*
* @readonly
* @member {module:core/editor/editor~Editor}
*/
this.editor = editor;
/**
* The value of the command. A given command class should define what it represents for it.
*
* For example, the `'bold'` command's value indicates whether the selection starts in a bolded text.
* And the value of the `'link'` command may be an object with link details.
*
* It is possible for a command to have no value (e.g. for stateless actions such as `'uploadImage'`).
*
* A given command class should control this value by overriding the {@link #refresh `refresh()`} method.
*
* @observable
* @readonly
* @member #value
*/
this.set('value', undefined);
/**
* Flag indicating whether a command is enabled or disabled.
* A disabled command will do nothing when executed.
*
* A given command class should control this value by overriding the {@link #refresh `refresh()`} method.
*
* It is possible to disable a command "from outside". For instance, in your integration you may want to disable
* a certain set of commands for the time being. To do that, you can use the fact that `isEnabled` is observable
* and it fires the `set:isEnabled` event every time anyone tries to modify its value:
*
* function disableCommand( cmd ) {
* cmd.on( 'set:isEnabled', forceDisable, { priority: 'highest' } );
*
* cmd.isEnabled = false;
*
* // Make it possible to enable the command again.
* return () => {
* cmd.off( 'set:isEnabled', forceDisable );
* cmd.refresh();
* };
*
* function forceDisable( evt ) {
* evt.return = false;
* evt.stop();
* }
* }
*
* // Usage:
*
* // Disabling the command.
* const enableBold = disableCommand( editor.commands.get( 'bold' ) );
*
* // Enabling the command again.
* enableBold();
*
* @observable
* @readonly
* @member {Boolean} #isEnabled
*/
this.set('isEnabled', false);
/**
* A flag indicating whether a command execution changes the editor data or not.
*
* Commands with `affectsData` set to `false` will not be automatically disabled in
* the {@link module:core/editor/editor~Editor#isReadOnly read-only mode} and
* {@glink features/read-only#related-features other editor modes} with restricted user write permissions.
*
* **Note:** You do not have to set it for your every command. It is `true` by default.
*
* @readonly
* @default true
* @member {Boolean} #affectsData
*/
this._affectsData = true;
/**
* Holds identifiers for {@link #forceDisabled} mechanism.
*
* @type {Set.<String>}
* @private
*/
this._disableStack = new Set();

@@ -137,2 +57,13 @@ this.decorate('execute');

}
/**
* A flag indicating whether a command execution changes the editor data or not.
*
* Commands with `affectsData` set to `false` will not be automatically disabled in
* the {@link module:core/editor/editor~Editor#isReadOnly read-only mode} and
* {@glink features/read-only#related-features other editor modes} with restricted user write permissions.
*
* **Note:** You do not have to set it for your every command. It is `true` by default.
*
* @default true
*/
get affectsData() {

@@ -163,23 +94,29 @@ return this._affectsData;

*
* command.isEnabled; // -> true
* command.forceDisabled( 'MyFeature' );
* command.isEnabled; // -> false
* command.clearForceDisabled( 'MyFeature' );
* command.isEnabled; // -> true
* ```ts
* command.isEnabled; // -> true
* command.forceDisabled( 'MyFeature' );
* command.isEnabled; // -> false
* command.clearForceDisabled( 'MyFeature' );
* command.isEnabled; // -> true
* ```
*
* Command disabled by multiple features:
*
* command.forceDisabled( 'MyFeature' );
* command.forceDisabled( 'OtherFeature' );
* command.clearForceDisabled( 'MyFeature' );
* command.isEnabled; // -> false
* command.clearForceDisabled( 'OtherFeature' );
* command.isEnabled; // -> true
* ```ts
* command.forceDisabled( 'MyFeature' );
* command.forceDisabled( 'OtherFeature' );
* command.clearForceDisabled( 'MyFeature' );
* command.isEnabled; // -> false
* command.clearForceDisabled( 'OtherFeature' );
* command.isEnabled; // -> true
* ```
*
* Multiple disabling with the same identifier is redundant:
*
* command.forceDisabled( 'MyFeature' );
* command.forceDisabled( 'MyFeature' );
* command.clearForceDisabled( 'MyFeature' );
* command.isEnabled; // -> true
* ```ts
* command.forceDisabled( 'MyFeature' );
* command.forceDisabled( 'MyFeature' );
* command.clearForceDisabled( 'MyFeature' );
* command.isEnabled; // -> true
* ```
*

@@ -189,3 +126,3 @@ * **Note:** some commands or algorithms may have more complex logic when it comes to enabling or disabling certain commands,

*
* @param {String} id Unique identifier for disabling. Use the same id when {@link #clearForceDisabled enabling back} the command.
* @param id Unique identifier for disabling. Use the same id when {@link #clearForceDisabled enabling back} the command.
*/

@@ -202,3 +139,3 @@ forceDisabled(id) {

*
* @param {String} id Unique identifier, equal to the one passed in {@link #forceDisabled} call.
* @param id Unique identifier, equal to the one passed in {@link #forceDisabled} call.
*/

@@ -236,3 +173,5 @@ clearForceDisabled(id) {

}
// Helper function that forces command to be disabled.
/**
* Helper function that forces command to be disabled.
*/
function forceDisable(evt) {

@@ -239,0 +178,0 @@ evt.return = false;

@@ -17,8 +17,2 @@ /**

constructor() {
/**
* Command map.
*
* @private
* @member {Map}
*/
this._commands = new Map();

@@ -29,4 +23,3 @@ }

*
* @param {String} commandName The name of the command.
* @param {module:core/command~Command} command
* @param commandName The name of the command.
*/

@@ -39,4 +32,3 @@ add(commandName, command) {

*
* @param {String} commandName The name of the command.
* @returns {module:core/command~Command}
* @param commandName The name of the command.
*/

@@ -49,7 +41,7 @@ get(commandName) {

*
* @param {String} commandName The name of the command.
* @param {*} [...commandParams] Command parameters.
* @returns {*} The value returned by the {@link module:core/command~Command#execute `command.execute()`}.
* @param commandName The name of the command.
* @param commandParams Command parameters.
* @returns The value returned by the {@link module:core/command~Command#execute `command.execute()`}.
*/
execute(commandName, ...args) {
execute(commandName, ...commandParams) {
const command = this.get(commandName);

@@ -61,12 +53,10 @@ if (!command) {

* @error commandcollection-command-not-found
* @param {String} commandName Name of the command.
* @param commandName Name of the command.
*/
throw new CKEditorError('commandcollection-command-not-found', this, { commandName });
}
return command.execute(...args);
return command.execute(...commandParams);
}
/**
* Returns iterator of command names.
*
* @returns {Iterable.<String>}
*/

@@ -78,4 +68,2 @@ *names() {

* Returns iterator of command instances.
*
* @returns {Iterable.<module:core/command~Command>}
*/

@@ -89,4 +77,2 @@ *commands() {

* Returns `[ commandName, commandInstance ]` pairs.
*
* @returns {Iterator.<Array>}
*/

@@ -93,0 +79,0 @@ [Symbol.iterator]() {

@@ -35,3 +35,3 @@ /**

*
* See {@link module:core/context~Context.create `Context.create()`} for usage examples.
* See {@link ~Context.create `Context.create()`} for usage examples.
*/

@@ -44,26 +44,17 @@ export default class Context {

*
* @param {Object} [config={}] The context configuration.
* @param config The context configuration.
*/
constructor(config) {
/**
* Stores all the configurations specific to this context instance.
* Reference to the editor which created the context.
* Null when the context was created outside of the editor.
*
* @readonly
* @type {module:utils/config~Config}
* It is used to destroy the context when removing the editor that has created the context.
*/
this._contextOwner = null;
this.config = new Config(config, this.constructor.defaultConfig);
const availablePlugins = this.constructor.builtinPlugins;
this.config.define('plugins', availablePlugins);
/**
* The plugins loaded and in use by this context instance.
*
* @readonly
* @type {module:core/plugincollection~PluginCollection}
*/
this.plugins = new PluginCollection(this, availablePlugins);
const languageConfig = this.config.get('language') || {};
/**
* @readonly
* @type {module:utils/locale~Locale}
*/
this.locale = new Locale({

@@ -73,26 +64,4 @@ uiLanguage: typeof languageConfig === 'string' ? languageConfig : languageConfig.ui,

});
/**
* Shorthand for {@link module:utils/locale~Locale#t}.
*
* @see module:utils/locale~Locale#t
* @method #t
*/
this.t = this.locale.t;
/**
* A list of editors that this context instance is injected to.
*
* @readonly
* @type {module:utils/collection~Collection}
*/
this.editors = new Collection();
/**
* Reference to the editor which created the context.
* Null when the context was created outside of the editor.
*
* It is used to destroy the context when removing the editor that has created the context.
*
* @private
* @type {module:core/editor/editor~Editor|null}
*/
this._contextOwner = null;
}

@@ -102,4 +71,3 @@ /**

*
* @returns {Promise.<module:core/plugin~LoadedPlugins>} A promise which resolves
* once the initialization is completed, providing an array of loaded plugins.
* @returns A promise which resolves once the initialization is completed, providing an array of loaded plugins.
*/

@@ -135,3 +103,3 @@ initPlugins() {

*
* @returns {Promise} A promise that resolves once the context instance is fully destroyed.
* @returns A promise that resolves once the context instance is fully destroyed.
*/

@@ -150,5 +118,4 @@ destroy() {

*
* @protected
* @param {module:core/editor/editor~Editor} editor
* @param {Boolean} isContextOwner Stores the given editor as a context owner.
* @internal
* @param isContextOwner Stores the given editor as a context owner.
*/

@@ -175,5 +142,4 @@ _addEditor(editor, isContextOwner) {

*
* @protected
* @param {module:core/editor/editor~Editor} editor
* @return {Promise} A promise that resolves once the editor is removed from the context or when the context was destroyed.
* @internal
* @return A promise that resolves once the editor is removed from the context or when the context was destroyed.
*/

@@ -197,4 +163,4 @@ _removeEditor(editor) {

*
* @protected
* @returns {Object} Configuration as a plain object.
* @internal
* @returns Configuration as a plain object.
*/

@@ -213,47 +179,49 @@ _getEditorConfig() {

*
* const commonConfig = { ... }; // Configuration for all the plugins and editors.
* const editorPlugins = [ ... ]; // Regular plugins here.
* ```ts
* const commonConfig = { ... }; // Configuration for all the plugins and editors.
* const editorPlugins = [ ... ]; // Regular plugins here.
*
* Context
* .create( {
* // Only context plugins here.
* plugins: [ ... ],
* Context
* .create( {
* // Only context plugins here.
* plugins: [ ... ],
*
* // Configure the language for all the editors (it cannot be overwritten).
* language: { ... },
* // Configure the language for all the editors (it cannot be overwritten).
* language: { ... },
*
* // Configuration for context plugins.
* comments: { ... },
* ...
* // Configuration for context plugins.
* comments: { ... },
* ...
*
* // Default configuration for editor plugins.
* toolbar: { ... },
* image: { ... },
* ...
* } )
* .then( context => {
* const promises = [];
* // Default configuration for editor plugins.
* toolbar: { ... },
* image: { ... },
* ...
* } )
* .then( context => {
* const promises = [];
*
* promises.push( ClassicEditor.create(
* document.getElementById( 'editor1' ),
* {
* editorPlugins,
* context
* }
* ) );
* promises.push( ClassicEditor.create(
* document.getElementById( 'editor1' ),
* {
* editorPlugins,
* context
* }
* ) );
*
* promises.push( ClassicEditor.create(
* document.getElementById( 'editor2' ),
* {
* editorPlugins,
* context,
* toolbar: { ... } // You can overwrite the configuration of the context.
* }
* ) );
* promises.push( ClassicEditor.create(
* document.getElementById( 'editor2' ),
* {
* editorPlugins,
* context,
* toolbar: { ... } // You can overwrite the configuration of the context.
* }
* ) );
*
* return Promise.all( promises );
* } );
* return Promise.all( promises );
* } );
* ```
*
* @param {Object} [config] The context configuration.
* @returns {Promise} A promise resolved once the context is ready. The promise resolves with the created context instance.
* @param config The context configuration.
* @returns A promise resolved once the context is ready. The promise resolves with the created context instance.
*/

@@ -260,0 +228,0 @@ static create(config) {

@@ -22,5 +22,2 @@ /**

* * A context plugin MUST NOT require an {@link module:core/plugin~Plugin editor plugin}.
*
* @implements module:core/plugin~PluginInterface
* @mixes module:utils/observablemixin~ObservableMixin
*/

@@ -30,13 +27,5 @@ export default class ContextPlugin extends ObservableMixin() {

* Creates a new plugin instance.
*
* @param {module:core/context~Context|module:core/editor/editor~Editor} context
*/
constructor(context) {
super();
/**
* The context instance.
*
* @readonly
* @type {module:core/context~Context|module:core/editor/editor~Editor}
*/
this.context = context;

@@ -43,0 +32,0 @@ }

@@ -16,7 +16,7 @@ /**

*
* editor.keystrokes.set( 'Ctrl+Z', 'undo' );
* editor.keystrokes.set( 'Ctrl+Shift+Z', 'redo' );
* editor.keystrokes.set( 'Ctrl+Y', 'redo' );
*
* @extends module:utils/keystrokehandler~KeystrokeHandler
* ```ts
* editor.keystrokes.set( 'Ctrl+Z', 'undo' );
* editor.keystrokes.set( 'Ctrl+Shift+Z', 'redo' );
* editor.keystrokes.set( 'Ctrl+Y', 'redo' );
* ```
*/

@@ -26,13 +26,5 @@ export default class EditingKeystrokeHandler extends KeystrokeHandler {

* Creates an instance of the keystroke handler.
*
* @param {module:core/editor/editor~Editor} editor
*/
constructor(editor) {
super();
/**
* The editor instance.
*
* @readonly
* @member {module:core/editor/editor~Editor}
*/
this.editor = editor;

@@ -45,5 +37,5 @@ }

*
* @param {String|Array.<String|Number>} keystroke Keystroke defined in a format accepted by
* @param keystroke Keystroke defined in a format accepted by
* the {@link module:utils/keyboard~parseKeystroke} function.
* @param {Function|String} callback If a string is passed, then the keystroke will
* @param callback If a string is passed, then the keystroke will
* {@link module:core/editor/editor~Editor#execute execute a command}.

@@ -53,5 +45,5 @@ * If a function, then it will be called with the

* a `cancel()` helper to both `preventDefault()` and `stopPropagation()` of the event.
* @param {Object} [options={}] Additional options.
* @param {module:utils/priorities~PriorityString|Number} [options.priority='normal'] The priority of the keystroke
* callback. The higher the priority value the sooner the callback will be executed. Keystrokes having the same priority
* @param options Additional options.
* @param options.priority The priority of the keystroke callback. The higher the priority value
* the sooner the callback will be executed. Keystrokes having the same priority
* are called in the order they were added.

@@ -58,0 +50,0 @@ */

@@ -31,5 +31,2 @@ /**

* (as most editor implementations do).
*
* @abstract
* @mixes module:utils/observablemixin~ObservableMixin
*/

@@ -40,5 +37,10 @@ export default class Editor extends ObservableMixin() {

*
* Usually, not to be used directly. See the static {@link module:core/editor/editor~Editor.create `create()`} method.
* Usually, not to be used directly. See the `create()` methods of the existing editor types to learn how to use them:
*
* @param {Object} [config={}] The editor configuration.
* * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`}
* * {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}
* * {@link module:editor-decoupled/decouplededitor~DecoupledEditor.create `DecoupledEditor.create()`}
* * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`}.
*
* @param config The editor configuration.
*/

@@ -50,9 +52,2 @@ constructor(config = {}) {

const language = config.language || (constructor.defaultConfig && constructor.defaultConfig.language);
/**
* The editor context.
* When it is not provided through the configuration, the editor creates it.
*
* @protected
* @type {module:core/context~Context}
*/
this._context = config.context || new Context({ language });

@@ -63,139 +58,21 @@ this._context._addEditor(this, !config.context);

const availablePlugins = Array.from(constructor.builtinPlugins || []);
/**
* Stores all configurations specific to this editor instance.
*
* editor.config.get( 'image.toolbar' );
* // -> [ 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ]
*
* @readonly
* @member {module:utils/config~Config}
*/
this.config = new Config(config, constructor.defaultConfig);
this.config.define('plugins', availablePlugins);
this.config.define(this._context._getEditorConfig());
/**
* The plugins loaded and in use by this editor instance.
*
* editor.plugins.get( 'ClipboardPipeline' ); // -> An instance of the clipboard pipeline plugin.
*
* @readonly
* @member {module:core/plugincollection~PluginCollection}
*/
this.plugins = new PluginCollection(this, availablePlugins, this._context.plugins);
/**
* The locale instance.
*
* @readonly
* @type {module:utils/locale~Locale}
*/
this.locale = this._context.locale;
/**
* Shorthand for {@link module:utils/locale~Locale#t}.
*
* @see module:utils/locale~Locale#t
* @method #t
*/
this.t = this.locale.t;
/**
* A set of lock IDs for the {@link #isReadOnly} getter.
*
* @private
* @type {Set.<String|Symbol>}
*/
this._readOnlyLocks = new Set();
/**
* Commands registered to the editor.
*
* Use the shorthand {@link #execute `editor.execute()`} method to execute commands:
*
* // Execute the bold command:
* editor.execute( 'bold' );
*
* // Check the state of the bold command:
* editor.commands.get( 'bold' ).value;
*
* @readonly
* @member {module:core/commandcollection~CommandCollection}
*/
this.commands = new CommandCollection();
/**
* Indicates the editor life-cycle state.
*
* The editor is in one of the following states:
*
* * `initializing` &ndash; During the editor initialization (before
* {@link module:core/editor/editor~Editor.create `Editor.create()`}) finished its job.
* * `ready` &ndash; After the promise returned by the {@link module:core/editor/editor~Editor.create `Editor.create()`}
* method is resolved.
* * `destroyed` &ndash; Once the {@link #destroy `editor.destroy()`} method was called.
*
* @observable
* @member {'initializing'|'ready'|'destroyed'} #state
*/
this.set('state', 'initializing');
this.once('ready', () => (this.state = 'ready'), { priority: 'high' });
this.once('destroy', () => (this.state = 'destroyed'), { priority: 'high' });
/**
* The editor's model.
*
* The central point of the editor's abstract data model.
*
* @readonly
* @member {module:engine/model/model~Model}
*/
this.model = new Model();
const stylesProcessor = new StylesProcessor();
/**
* The {@link module:engine/controller/datacontroller~DataController data controller}.
* Used e.g. for setting and retrieving the editor data.
*
* @readonly
* @member {module:engine/controller/datacontroller~DataController}
*/
this.data = new DataController(this.model, stylesProcessor);
/**
* The {@link module:engine/controller/editingcontroller~EditingController editing controller}.
* Controls user input and rendering the content for editing.
*
* @readonly
* @member {module:engine/controller/editingcontroller~EditingController}
*/
this.editing = new EditingController(this.model, stylesProcessor);
this.editing.view.document.bind('isReadOnly').to(this);
/**
* Conversion manager through which you can register model-to-view and view-to-model converters.
*
* See the {@link module:engine/conversion/conversion~Conversion} documentation to learn how to add converters.
*
* @readonly
* @member {module:engine/conversion/conversion~Conversion}
*/
this.conversion = new Conversion([this.editing.downcastDispatcher, this.data.downcastDispatcher], this.data.upcastDispatcher);
this.conversion.addAlias('dataDowncast', this.data.downcastDispatcher);
this.conversion.addAlias('editingDowncast', this.editing.downcastDispatcher);
/**
* An instance of the {@link module:core/editingkeystrokehandler~EditingKeystrokeHandler}.
*
* It allows setting simple keystrokes:
*
* // Execute the bold command on Ctrl+E:
* editor.keystrokes.set( 'Ctrl+E', 'bold' );
*
* // Execute your own callback:
* editor.keystrokes.set( 'Ctrl+E', ( data, cancel ) => {
* console.log( data.keyCode );
*
* // Prevent the default (native) action and stop the underlying keydown event
* // so no other editor feature will interfere.
* cancel();
* } );
*
* Note: Certain typing-oriented keystrokes (like <kbd>Backspace</kbd> or <kbd>Enter</kbd>) are handled
* by a low-level mechanism and trying to listen to them via the keystroke handler will not work reliably.
* To handle these specific keystrokes, see the events fired by the
* {@link module:engine/view/document~Document editing view document} (`editor.editing.view.document`).
*
* @readonly
* @member {module:core/editingkeystrokehandler~EditingKeystrokeHandler}
*/
this.keystrokes = new EditingKeystrokeHandler(this);

@@ -212,11 +89,14 @@ this.keystrokes.listenTo(this.editing.view.document);

*
* editor.enableReadOnlyMode( 'feature-id' );
* ```ts
* editor.enableReadOnlyMode( 'feature-id' );
* ```
*
* Later, to turn off the read-only mode, call {@link #disableReadOnlyMode}:
*
* editor.disableReadOnlyMode( 'feature-id' );
* ```ts
* editor.disableReadOnlyMode( 'feature-id' );
* ```
*
* @readonly
* @observable
* @member {Boolean} #isReadOnly
*/

@@ -234,9 +114,13 @@ get isReadOnly() {

*
* editor.isReadOnly = true;
* editor.isReadOnly = false;
* ```ts
* editor.isReadOnly = true;
* editor.isReadOnly = false;
* ```
*
* Usage since version `34.0.0`:
*
* editor.enableReadOnlyMode( 'my-feature-id' );
* editor.disableReadOnlyMode( 'my-feature-id' );
* ```ts
* editor.enableReadOnlyMode( 'my-feature-id' );
* editor.disableReadOnlyMode( 'my-feature-id' );
* ```
*

@@ -262,24 +146,30 @@ * @error editor-isreadonly-has-no-setter

*
* editor.isReadOnly; // `false`.
* editor.enableReadOnlyMode( 'my-feature-id' );
* editor.isReadOnly; // `true`.
* ```ts
* editor.isReadOnly; // `false`.
* editor.enableReadOnlyMode( 'my-feature-id' );
* editor.isReadOnly; // `true`.
* ```
*
* You can turn off the read-only mode ("clear the lock") using the {@link #disableReadOnlyMode `disableReadOnlyMode()`} method:
*
* editor.enableReadOnlyMode( 'my-feature-id' );
* // ...
* editor.disableReadOnlyMode( 'my-feature-id' );
* editor.isReadOnly; // `false`.
* ```ts
* editor.enableReadOnlyMode( 'my-feature-id' );
* // ...
* editor.disableReadOnlyMode( 'my-feature-id' );
* editor.isReadOnly; // `false`.
* ```
*
* All "locks" need to be removed to enable editing:
*
* editor.enableReadOnlyMode( 'my-feature-id' );
* editor.enableReadOnlyMode( 'my-other-feature-id' );
* // ...
* editor.disableReadOnlyMode( 'my-feature-id' );
* editor.isReadOnly; // `true`.
* editor.disableReadOnlyMode( 'my-other-feature-id' );
* editor.isReadOnly; // `false`.
* ```ts
* editor.enableReadOnlyMode( 'my-feature-id' );
* editor.enableReadOnlyMode( 'my-other-feature-id' );
* // ...
* editor.disableReadOnlyMode( 'my-feature-id' );
* editor.isReadOnly; // `true`.
* editor.disableReadOnlyMode( 'my-other-feature-id' );
* editor.isReadOnly; // `false`.
* ```
*
* @param {String|Symbol} lockId A unique ID for setting the editor to the read-only state.
* @param lockId A unique ID for setting the editor to the read-only state.
*/

@@ -309,3 +199,3 @@ enableReadOnlyMode(lockId) {

*
* @param {String|Symbol} lockId The lock ID for setting the editor to the read-only state.
* @param lockId The lock ID for setting the editor to the read-only state.
*/

@@ -328,4 +218,3 @@ disableReadOnlyMode(lockId) {

*
* @returns {Promise.<module:core/plugin~LoadedPlugins>} A promise which resolves
* once the initialization is completed, providing an array of loaded plugins.
* @returns A promise which resolves once the initialization is completed, providing an array of loaded plugins.
*/

@@ -347,3 +236,3 @@ initPlugins() {

* @fires destroy
* @returns {Promise} A promise that resolves once the editor instance is fully destroyed.
* @returns A promise that resolves once the editor instance is fully destroyed.
*/

@@ -377,11 +266,13 @@ destroy() {

*
* editor.commands.get( commandName ).execute( ... );
* ```ts
* editor.commands.get( commandName ).execute( ... );
* ```
*
* @param {String} commandName The name of the command to execute.
* @param {*} [...commandParams] Command parameters.
* @returns {*} The value returned by the {@link module:core/commandcollection~CommandCollection#execute `commands.execute()`}.
* @param commandName The name of the command to execute.
* @param commandParams Command parameters.
* @returns The value returned by the {@link module:core/commandcollection~CommandCollection#execute `commands.execute()`}.
*/
execute(commandName, ...args) {
execute(commandName, ...commandParams) {
try {
return this.commands.execute(commandName, ...args);
return this.commands.execute(commandName, ...commandParams);
}

@@ -400,4 +291,4 @@ catch (err) {

*
* Check out the {@glink framework/guides/deep-dive/ui/focus-tracking#focus-in-the-editor-ui Focus in the editor UI} section
* of the {@glink framework/guides/deep-dive/ui/focus-tracking Deep dive into focus tracking} guide to learn more.
* Check out the {@glink framework/deep-dive/ui/focus-tracking#focus-in-the-editor-ui Focus in the editor UI} section
* of the {@glink framework/deep-dive/ui/focus-tracking Deep dive into focus tracking} guide to learn more.
*/

@@ -416,84 +307,9 @@ focus() {

*
* <div id="editor">
* <p>Initial content.</p>
* </div>
* ```html
* <div id="editor">
* <p>Initial content.</p>
* </div>
* ```
*
* @error editor-wrong-element
*/
/**
* An array of plugins built into this editor class.
*
* It is used in CKEditor 5 builds to provide a list of plugins which are later automatically initialized
* during the editor initialization.
*
* They will be automatically initialized by the editor, unless listed in `config.removePlugins` and
* unless `config.plugins` is passed.
*
* // Build some plugins into the editor class first.
* ClassicEditor.builtinPlugins = [ FooPlugin, BarPlugin ];
*
* // Normally, you need to define config.plugins, but since ClassicEditor.builtinPlugins was
* // defined, now you can call create() without any configuration.
* ClassicEditor
* .create( sourceElement )
* .then( editor => {
* editor.plugins.get( FooPlugin ); // -> An instance of the Foo plugin.
* editor.plugins.get( BarPlugin ); // -> An instance of the Bar plugin.
* } );
*
* ClassicEditor
* .create( sourceElement, {
* // Do not initialize these plugins (note: it is defined by a string):
* removePlugins: [ 'Foo' ]
* } )
* .then( editor => {
* editor.plugins.get( FooPlugin ); // -> Undefined.
* editor.config.get( BarPlugin ); // -> An instance of the Bar plugin.
* } );
*
* ClassicEditor
* .create( sourceElement, {
* // Load only this plugin. It can also be defined by a string if
* // this plugin was built into the editor class.
* plugins: [ FooPlugin ]
* } )
* .then( editor => {
* editor.plugins.get( FooPlugin ); // -> An instance of the Foo plugin.
* editor.config.get( BarPlugin ); // -> Undefined.
* } );
*
* See also {@link module:core/editor/editor~Editor.defaultConfig}.
*
* @static
* @member {Array.<Function>} module:core/editor/editor~Editor.builtinPlugins
*/
/**
* The default configuration which is built into the editor class.
*
* It is used in CKEditor 5 builds to provide the default configuration options which are later used during the editor initialization.
*
* ClassicEditor.defaultConfig = {
* foo: 1,
* bar: 2
* };
*
* ClassicEditor
* .create( sourceElement )
* .then( editor => {
* editor.config.get( 'foo' ); // -> 1
* editor.config.get( 'bar' ); // -> 2
* } );
*
* // The default options can be overridden by the configuration passed to create().
* ClassicEditor
* .create( sourceElement, { bar: 3 } )
* .then( editor => {
* editor.config.get( 'foo' ); // -> 1
* editor.config.get( 'bar' ); // -> 3
* } );
*
* See also {@link module:core/editor/editor~Editor.builtinPlugins}.
*
* @static
* @member {Object} module:core/editor/editor~Editor.defaultConfig
*/

@@ -5,7 +5,7 @@ /**

*/
import { isFunction } from 'lodash-es';
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
/**
* @module core/editor/utils/attachtoform
*/
import { isFunction } from 'lodash-es';
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
/**

@@ -17,3 +17,3 @@ * Checks if the editor is initialized on a `<textarea>` element that belongs to a form. If yes, it updates the editor's element

*
* @param {module:core/editor/editor~Editor} editor Editor instance.
* @param editor Editor instance.
*/

@@ -20,0 +20,0 @@ export default function attachToForm(editor) {

@@ -6,9 +6,3 @@ /**

/**
* @module core/editor/utils/dataapimixin
*/
/**
* Implementation of the {@link module:core/editor/utils/dataapimixin~DataApi}.
*
* @mixin DataApiMixin
* @implements module:core/editor/utils/dataapimixin~DataApi
*/

@@ -15,0 +9,0 @@ export default function DataApiMixin(base) {

@@ -5,12 +5,8 @@ /**

*/
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { CKEditorError, setDataInElement } from '@ckeditor/ckeditor5-utils';
/**
* @module core/editor/utils/elementapimixin
*/
import { CKEditorError, setDataInElement } from '@ckeditor/ckeditor5-utils';
/**
* Implementation of the {@link module:core/editor/utils/elementapimixin~ElementApi}.
*
* @mixin ElementApiMixin
* @implements module:core/editor/utils/elementapimixin~ElementApi
*/

@@ -17,0 +13,0 @@ export default function ElementApiMixin(base) {

@@ -5,6 +5,6 @@ /**

*/
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
/**
* @module core/editor/utils/securesourceelement
*/
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
/**

@@ -16,3 +16,3 @@ * Marks the source element on which the editor was initialized. This prevents other editor instances from using this element.

*
* @param {module:core/editor/editor~Editor} editor Editor instance.
* @param editor Editor instance.
*/

@@ -33,3 +33,3 @@ export default function secureSourceElement(editor) {

* @error editor-source-element-already-used
* @param {HTMLElement} element DOM element that caused the collision.
* @param element DOM element that caused the collision.
*/

@@ -36,0 +36,0 @@ throw new CKEditorError('editor-source-element-already-used', editor);

@@ -5,7 +5,7 @@ /**

*/
import Command from './command';
import { insertToPriorityArray } from '@ckeditor/ckeditor5-utils';
/**
* @module core/multicommand
*/
import Command from './command';
import { insertToPriorityArray } from '@ckeditor/ckeditor5-utils';
/**

@@ -18,30 +18,24 @@ * A CKEditor command that aggregates other commands.

*
* const multiCommand = new MultiCommand( editor );
* ```ts
* const multiCommand = new MultiCommand( editor );
*
* const commandFoo = new Command( editor );
* const commandBar = new Command( editor );
* const commandFoo = new Command( editor );
* const commandBar = new Command( editor );
*
* // Register a child command.
* multiCommand.registerChildCommand( commandFoo );
* // Register a child command with a low priority.
* multiCommand.registerChildCommand( commandBar, { priority: 'low' } );
* // Register a child command.
* multiCommand.registerChildCommand( commandFoo );
* // Register a child command with a low priority.
* multiCommand.registerChildCommand( commandBar, { priority: 'low' } );
*
* // Enable one of the commands.
* commandBar.isEnabled = true;
* // Enable one of the commands.
* commandBar.isEnabled = true;
*
* multiCommand.execute(); // Will execute commandBar.
*
* @extends module:core/command~Command
* multiCommand.execute(); // Will execute commandBar.
* ```
*/
export default class MultiCommand extends Command {
/**
* @inheritDoc
*/
constructor(editor) {
super(editor);
constructor() {
super(...arguments);
/**
* Registered child commands definitions.
*
* @type {Array.<Object>}
* @private
*/

@@ -59,3 +53,3 @@ this._childCommandsDefinitions = [];

*
* @returns {*} The value returned by the {@link module:core/command~Command#execute `command.execute()`}.
* @returns The value returned by the {@link module:core/command~Command#execute `command.execute()`}.
*/

@@ -69,5 +63,4 @@ execute(...args) {

*
* @param {module:core/command~Command} command
* @param {Object} options An object with configuration options.
* @param {module:utils/priorities~PriorityString} [options.priority='normal'] Priority of a command to register.
* @param options An object with configuration options.
* @param options.priority Priority of a command to register.
*/

@@ -82,4 +75,2 @@ registerChildCommand(command, options = {}) {

* Checks if any of child commands is enabled.
*
* @private
*/

@@ -91,5 +82,2 @@ _checkEnabled() {

* Returns a first enabled command with the highest priority or `undefined` if none of them is enabled.
*
* @returns {module:core/command~Command|undefined}
* @private
*/

@@ -96,0 +84,0 @@ _getFirstEnabledCommand() {

@@ -21,24 +21,30 @@ /**

*
* const pendingActions = editor.plugins.get( 'PendingActions' );
* const action = pendingActions.add( 'Upload in progress: 0%.' );
* ```ts
* const pendingActions = editor.plugins.get( 'PendingActions' );
* const action = pendingActions.add( 'Upload in progress: 0%.' );
*
* // You can update the message:
* action.message = 'Upload in progress: 10%.';
* // You can update the message:
* action.message = 'Upload in progress: 10%.';
* ```
*
* Removing a pending action:
*
* const pendingActions = editor.plugins.get( 'PendingActions' );
* const action = pendingActions.add( 'Unsaved changes.' );
* ```ts
* const pendingActions = editor.plugins.get( 'PendingActions' );
* const action = pendingActions.add( 'Unsaved changes.' );
*
* pendingActions.remove( action );
* pendingActions.remove( action );
* ```
*
* Getting pending actions:
*
* const pendingActions = editor.plugins.get( 'PendingActions' );
* ```ts
* const pendingActions = editor.plugins.get( 'PendingActions' );
*
* const action1 = pendingActions.add( 'Action 1' );
* const action2 = pendingActions.add( 'Action 2' );
* const action1 = pendingActions.add( 'Action 1' );
* const action2 = pendingActions.add( 'Action 2' );
*
* pendingActions.first; // Returns action1
* Array.from( pendingActions ); // Returns [ action1, action2 ]
* pendingActions.first; // Returns action1
* Array.from( pendingActions ); // Returns [ action1, action2 ]
* ```
*

@@ -48,4 +54,2 @@ * This plugin is used by features like {@link module:upload/filerepository~FileRepository} to register their ongoing actions

* Read more about saving the data in the {@glink installation/getting-started/getting-and-setting-data Saving and getting data} guide.
*
* @extends module:core/contextplugin~ContextPlugin
*/

@@ -63,16 +67,3 @@ export default class PendingActions extends ContextPlugin {

init() {
/**
* Defines whether there is any registered pending action.
*
* @readonly
* @observable
* @member {Boolean} #hasAny
*/
this.set('hasAny', false);
/**
* A list of pending actions.
*
* @private
* @type {module:utils/collection~Collection}
*/
this._actions = new Collection({ idProperty: '_id' });

@@ -87,4 +78,4 @@ this._actions.delegate('add', 'remove').to(this);

*
* @param {String} message The action message.
* @returns {Object} An observable object that represents a pending action.
* @param message The action message.
* @returns An observable object that represents a pending action.
*/

@@ -109,3 +100,3 @@ add(message) {

*
* @param {Object} action An action object.
* @param action An action object.
*/

@@ -119,3 +110,3 @@ remove(action) {

*
* returns {Object|null} The pending action object.
* @returns The pending action object.
*/

@@ -127,4 +118,2 @@ get first() {

* Iterable interface.
*
* @returns {Iterable.<*>}
*/

@@ -131,0 +120,0 @@ [Symbol.iterator]() {

@@ -5,12 +5,9 @@ /**

*/
/* eslint-disable @typescript-eslint/no-invalid-void-type */
/**
* @module core/plugin
*/
/* eslint-disable @typescript-eslint/no-invalid-void-type */
import { ObservableMixin } from '@ckeditor/ckeditor5-utils';
/**
* The base class for CKEditor plugin classes.
*
* @implements module:core/plugin~PluginInterface
* @mixes module:utils/observablemixin~ObservableMixin
*/

@@ -24,41 +21,7 @@ export default class Plugin extends ObservableMixin() {

/**
* The editor instance.
*
* Note that most editors implement the {@link module:core/editor/editorwithui~EditorWithUI} interface in addition
* to the base {@link module:core/editor/editor~Editor} interface. However, editors with an external UI
* (i.e. Bootstrap-based) or a headless editor may not implement the {@link module:core/editor/editorwithui~EditorWithUI}
* interface.
*
* Because of above, to make plugins more universal, it is recommended to split features into:
* - The "editing" part that only uses the {@link module:core/editor/editor~Editor} interface.
* - The "UI" part that uses both the {@link module:core/editor/editor~Editor} interface and
* the {@link module:core/editor/editorwithui~EditorWithUI} interface.
*
* @readonly
* @member {module:core/editor/editor~Editor} #editor
* Holds identifiers for {@link #forceDisabled} mechanism.
*/
this._disableStack = new Set();
this.editor = editor;
/**
* Flag indicating whether a plugin is enabled or disabled.
* A disabled plugin will not transform text.
*
* Plugin can be simply disabled like that:
*
* // Disable the plugin so that no toolbars are visible.
* editor.plugins.get( 'TextTransformation' ).isEnabled = false;
*
* You can also use {@link #forceDisabled} method.
*
* @observable
* @readonly
* @member {Boolean} #isEnabled
*/
this.set('isEnabled', true);
/**
* Holds identifiers for {@link #forceDisabled} mechanism.
*
* @type {Set.<String>}
* @private
*/
this._disableStack = new Set();
}

@@ -74,23 +37,29 @@ /**

*
* plugin.isEnabled; // -> true
* plugin.forceDisabled( 'MyFeature' );
* plugin.isEnabled; // -> false
* plugin.clearForceDisabled( 'MyFeature' );
* plugin.isEnabled; // -> true
* ```ts
* plugin.isEnabled; // -> true
* plugin.forceDisabled( 'MyFeature' );
* plugin.isEnabled; // -> false
* plugin.clearForceDisabled( 'MyFeature' );
* plugin.isEnabled; // -> true
* ```
*
* Plugin disabled by multiple features:
*
* plugin.forceDisabled( 'MyFeature' );
* plugin.forceDisabled( 'OtherFeature' );
* plugin.clearForceDisabled( 'MyFeature' );
* plugin.isEnabled; // -> false
* plugin.clearForceDisabled( 'OtherFeature' );
* plugin.isEnabled; // -> true
* ```ts
* plugin.forceDisabled( 'MyFeature' );
* plugin.forceDisabled( 'OtherFeature' );
* plugin.clearForceDisabled( 'MyFeature' );
* plugin.isEnabled; // -> false
* plugin.clearForceDisabled( 'OtherFeature' );
* plugin.isEnabled; // -> true
* ```
*
* Multiple disabling with the same identifier is redundant:
*
* plugin.forceDisabled( 'MyFeature' );
* plugin.forceDisabled( 'MyFeature' );
* plugin.clearForceDisabled( 'MyFeature' );
* plugin.isEnabled; // -> true
* ```ts
* plugin.forceDisabled( 'MyFeature' );
* plugin.forceDisabled( 'MyFeature' );
* plugin.clearForceDisabled( 'MyFeature' );
* plugin.isEnabled; // -> true
* ```
*

@@ -100,3 +69,3 @@ * **Note:** some plugins or algorithms may have more complex logic when it comes to enabling or disabling certain plugins,

*
* @param {String} id Unique identifier for disabling. Use the same id when {@link #clearForceDisabled enabling back} the plugin.
* @param id Unique identifier for disabling. Use the same id when {@link #clearForceDisabled enabling back} the plugin.
*/

@@ -113,3 +82,3 @@ forceDisabled(id) {

*
* @param {String} id Unique identifier, equal to the one passed in {@link #forceDisabled} call.
* @param id Unique identifier, equal to the one passed in {@link #forceDisabled} call.
*/

@@ -136,3 +105,5 @@ clearForceDisabled(id) {

}
// Helper function that forces plugin to be disabled.
/**
* Helper function that forces plugin to be disabled.
*/
function forceDisable(evt) {

@@ -139,0 +110,0 @@ evt.return = false;

@@ -11,4 +11,2 @@ /**

* Manages a list of CKEditor plugins, including loading, resolving dependencies and initialization.
*
* @mixes module:utils/emittermixin~EmitterMixin
*/

@@ -21,28 +19,12 @@ export default class PluginCollection extends EmitterMixin() {

*
* @param {module:core/editor/editor~Editor|module:core/context~Context} context
* @param {Array.<Function>} [availablePlugins] Plugins (constructors) which the collection will be able to use
* @param availablePlugins Plugins (constructors) which the collection will be able to use
* when {@link module:core/plugincollection~PluginCollection#init} is used with the plugin names (strings, instead of constructors).
* Usually, the editor will pass its built-in plugins to the collection so they can later be
* used in `config.plugins` or `config.removePlugins` by names.
* @param {Iterable.<Array>} contextPlugins A list of already initialized plugins represented by a
* `[ PluginConstructor, pluginInstance ]` pair.
* @param contextPlugins A list of already initialized plugins represented by a `[ PluginConstructor, pluginInstance ]` pair.
*/
constructor(context, availablePlugins = [], contextPlugins = []) {
super();
/**
* @protected
* @type {module:core/editor/editor~Editor|module:core/context~Context}
*/
this._plugins = new Map();
this._context = context;
/**
* @protected
* @type {Map}
*/
this._plugins = new Map();
/**
* A map of plugin constructors that can be retrieved by their names.
*
* @protected
* @type {Map.<String|Function,Function>}
*/
this._availablePlugins = new Map();

@@ -54,8 +36,2 @@ for (const PluginConstructor of availablePlugins) {

}
/**
* Map of {@link module:core/contextplugin~ContextPlugin context plugins} which can be retrieved by their constructors or instances.
*
* @protected
* @type {Map<Function,Function>}
*/
this._contextPlugins = new Map();

@@ -75,4 +51,2 @@ for (const [PluginConstructor, pluginInstance] of contextPlugins) {

* Returns `[ PluginConstructor, pluginInstance ]` pairs.
*
* @returns {Iterable.<Array>}
*/

@@ -105,3 +79,3 @@ *[Symbol.iterator]() {

* @error plugincollection-plugin-not-loaded
* @param {String} plugin The name of the plugin which is not loaded.
* @param plugin The name of the plugin which is not loaded.
*/

@@ -115,12 +89,13 @@ throw new CKEditorError('plugincollection-plugin-not-loaded', this._context, { plugin: pluginName });

*
* // Check if the 'Clipboard' plugin was loaded.
* if ( editor.plugins.has( 'ClipboardPipeline' ) ) {
* // Now use the clipboard plugin instance:
* const clipboard = editor.plugins.get( 'ClipboardPipeline' );
* ```ts
* // Check if the 'Clipboard' plugin was loaded.
* if ( editor.plugins.has( 'ClipboardPipeline' ) ) {
* // Now use the clipboard plugin instance:
* const clipboard = editor.plugins.get( 'ClipboardPipeline' );
*
* // ...
* }
* // ...
* }
* ```
*
* @param {Function|String} key The plugin constructor or {@link module:core/plugin~PluginInterface.pluginName name}.
* @returns {Boolean}
* @param key The plugin constructor or {@link module:core/plugin~PluginStaticMembers#pluginName name}.
*/

@@ -133,7 +108,7 @@ has(key) {

*
* @param {Array.<Function|String>} plugins An array of {@link module:core/plugin~PluginInterface plugin constructors}
* or {@link module:core/plugin~PluginInterface.pluginName plugin names}.
* @param {Array.<String|Function>} [pluginsToRemove] Names of the plugins or plugin constructors
* @param plugins An array of {@link module:core/plugin~PluginInterface plugin constructors}
* or {@link module:core/plugin~PluginStaticMembers#pluginName plugin names}.
* @param pluginsToRemove Names of the plugins or plugin constructors
* that should not be loaded (despite being specified in the `plugins` array).
* @param {Array.<Function>} [pluginsSubstitutions] An array of {@link module:core/plugin~PluginInterface plugin constructors}
* @param pluginsSubstitutions An array of {@link module:core/plugin~PluginInterface plugin constructors}
* that will be used to replace plugins of the same names that were passed in `plugins` or that are in their dependency tree.

@@ -145,4 +120,3 @@ * A useful option for replacing built-in plugins while creating tests (for mocking their APIs). Plugins that will be replaced

* * Both plugins must not depend on other plugins.
* @returns {Promise.<module:core/plugin~LoadedPlugins>} A promise which gets resolved once all plugins are loaded
* and available in the collection.
* @returns A promise which gets resolved once all plugins are loaded and available in the collection.
*/

@@ -180,3 +154,3 @@ init(plugins, pluginsToRemove = [], pluginsSubstitutions = []) {

function isContextPlugin(plugin) {
return isPluginConstructor(plugin) && plugin.isContextPlugin;
return isPluginConstructor(plugin) && !!plugin.isContextPlugin;
}

@@ -276,4 +250,4 @@ function isPluginRemoved(plugin, pluginsToRemove) {

* @error plugincollection-soft-required
* @param {String} missingPlugin The name of the required plugin.
* @param {String} requiredBy The name of the plugin that requires the other plugin.
* @param missingPlugin The name of the required plugin.
* @param requiredBy The name of the plugin that requires the other plugin.
*/

@@ -299,6 +273,6 @@ throw new CKEditorError('plugincollection-soft-required', context, { missingPlugin: plugin, requiredBy: getPluginName(parentPluginConstructor) });

* provide each plugin through a reference (as a constructor function). Check out the examples in
* {@glink installation/advanced/alternative-setups/integrating-from-source "Building from source"}.
* {@glink installation/advanced/alternative-setups/integrating-from-source-webpack "Building from source"}.
*
* @error plugincollection-plugin-not-found
* @param {String} plugin The name of the plugin which could not be loaded.
* @param plugin The name of the plugin which could not be loaded.
*/

@@ -323,4 +297,4 @@ throw new CKEditorError('plugincollection-plugin-not-found', context, { plugin });

* @error plugincollection-context-required
* @param {String} plugin The name of the required plugin.
* @param {String} requiredBy The name of the parent plugin.
* @param plugin The name of the required plugin.
* @param requiredBy The name of the parent plugin.
*/

@@ -340,4 +314,4 @@ throw new CKEditorError('plugincollection-context-required', context, { plugin: getPluginName(plugin), requiredBy: getPluginName(parentPluginConstructor) });

* @error plugincollection-required
* @param {String} plugin The name of the required plugin.
* @param {String} requiredBy The name of the parent plugin.
* @param plugin The name of the required plugin.
* @param requiredBy The name of the parent plugin.
*/

@@ -365,6 +339,5 @@ throw new CKEditorError('plugincollection-required', context, { plugin: getPluginName(plugin), requiredBy: getPluginName(parentPluginConstructor) });

}
// Replaces plugin constructors with the specified set of plugins.
//
// @param {Array.<Function>} pluginConstructors
// @param {Array.<Function>} pluginsSubstitutions
/**
* Replaces plugin constructors with the specified set of plugins.
*/
function substitutePlugins(pluginConstructors, pluginsSubstitutions) {

@@ -437,4 +410,2 @@ for (const pluginItem of pluginsSubstitutions) {

* Destroys all loaded plugins.
*
* @returns {Promise}
*/

@@ -453,5 +424,4 @@ destroy() {

*
* @protected
* @param {Function} PluginConstructor The plugin constructor.
* @param {module:core/plugin~PluginInterface} plugin The instance of the plugin.
* @param PluginConstructor The plugin constructor.
* @param plugin The instance of the plugin.
*/

@@ -488,8 +458,8 @@ _add(PluginConstructor, plugin) {

*
* Read more about {@glink installation/getting-started/installing-plugins installing plugins}.
* Read more about {@glink installation/plugins/installing-plugins Installing plugins}.
*
* @error plugincollection-plugin-name-conflict
* @param {String} pluginName The duplicated plugin name.
* @param {Function} plugin1 The first plugin constructor.
* @param {Function} plugin2 The second plugin constructor.
* @param pluginName The duplicated plugin name.
* @param plugin1 The first plugin constructor.
* @param plugin2 The second plugin constructor.
*/

@@ -496,0 +466,0 @@ throw new CKEditorError('plugincollection-plugin-name-conflict', null, { pluginName, plugin1: this._plugins.get(pluginName).constructor, plugin2: PluginConstructor });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc