Class

CommandCollection (core)

@ckeditor/ckeditor5-core/src/commandcollection

class

Collection of commands. Its instance is available in editor.commands.

Filtering

Properties

  • _commands : Map

    private

    Command map.

Methods

  • constructor()

    Creates collection instance.

  • Symbol.iterator() → Iterable.<Array>

    Iterable interface.

    Returns [ commandName, commandInstance ] pairs.

    Returns

    Iterable.<Array>
  • add( commandName, command )

    Registers a new command.

    Parameters

    commandName : String

    The name of the command.

    command : Command
  • commands() → Iterable.<Command>

    Returns iterator of command instances.

    Returns

    Iterable.<Command>
  • destroy()

    Destroys all collection commands.

  • execute( commandName, [ ...commandParams ] ) → *

    Executes a command.

    Parameters

    commandName : String

    The name of the command.

    [ ...commandParams ] : *

    Command parameters.

    Returns

    *

    The value returned by the command.execute().

  • get( commandName ) → Command

    Retrieves a command from the collection.

    Parameters

    commandName : String

    The name of the command.

    Returns

    Command
  • names() → Iterable.<String>

    Returns iterator of command names.

    Returns

    Iterable.<String>