PluginCollection (core)
@ckeditor/ckeditor5-core/src/plugincollection
Manages a list of CKEditor plugins, including loading, resolving dependencies and initialization.
Filtering
Methods
-
constructor( editor, [ availablePlugins ] )
Creates an instance of the PluginCollection class. Allows loading and initializing plugins and their dependencies.
Parameters
editor : Editor
[ availablePlugins ] : Array.<Function>
Plugins (constructors) which the collection will be able to use when
load
is used with plugin names (strings, instead of constructors). Usually, the editor will pass its built-in plugins to the collection so they can later be used inconfig.plugins
orconfig.removePlugins
by names.
-
Symbol.iterator() → Iterable.<Array>
Iterable interface.
Returns
[ PluginConstructor, pluginInstance ]
pairs.Returns
Iterable.<Array>
-
destroy() → Promise
Destroys all loaded plugins.
Returns
Promise
-
get( key ) → PluginInterface
Gets the plugin instance by its constructor or name.
-
load( plugins, [ removePlugins ] ) → Promise
Loads a set of plugins and adds them to the collection.
Parameters
plugins : Array.<(Function | String)>
An array of plugin constructors or plugin names. The second option (names) works only if
availablePlugins
were passed to theconstructor
.[ removePlugins ] : Array.<(String | Function)>
Names of plugins or plugin constructors that should not be loaded (despite being specified in the
plugins
array).
Returns
Promise
A promise which gets resolved once all plugins are loaded and available in the collection.
Promise.<PluginInterface>>
returns.loadedPlugins The array of loaded plugins.
-
_add( PluginConstructor, plugin )
protected
Adds the plugin to the collection. Exposed mainly for testing purposes.
Parameters
PluginConstructor : function
The plugin constructor.
plugin : PluginInterface
The instance of the plugin.