Interface

SlashCommandDefinition (slash-command)

@ckeditor/ckeditor5-slash-command/src/slashcommandconfig

interface

An object describing a single command definition in the configuration.

Filtering

Properties

  • aliases : Array<string> | undefined

    An optional list of aliases (extending the base id) to be used when filtering the list of slash commands based on the text that follows the slash ("/") character.

  • commandName : string | undefined

    The name of the command to be executed if the execute property was not provided, for example, 'blockQuote', 'heading'. See commands to learn more about available commands.

  • description : string | undefined

    An optional description for the command. Useful when the title is not descriptive enough.

  • execute : Function | undefined

    A callback function defining custom logic for executing the command. If not provided, the default command's execute is used instead. Custom logic is useful especially when the slash command requires some arguments (acts like a wrapper) or combines some complex logic. This property is obligatory if commandName was not passed.

    This callback gets an Editor instance as a parameter.

  • icon : string | undefined

    An SVG string representing the icon of the command. If not provided, a generic icon will be used instead. The default size of the icon is 20x20 pixels. Be sure to set the correct viewBox attribute in the icon source.

    See isIconColorInherited.

  • id : string

    A unique ID matched with the text that follows the slash ("/") character typed by the user, e.g. 'blockQuote', 'heading1'. See aliases to learn about slash command aliases that provide a similar functionality.

  • isEnabled : Function | undefined

    A callback function defining custom logic to decide if the command should be displayed in the dropdown list. If not provided, the default command's isEnabled property is used instead. If it's also unavailable, it falls back to true. This property is checked when a user types the slash ("/") character or changes the text that follows it.

    This callback gets an Editor instance as a parameter.

  • isIconColorInherited : boolean | undefined

    By default, slash command icons are monochromatic and inherit the color of the text in the editor UI. Setting this property to false disables this inheritance and allows the use of complex (colorful) icons.

    Learn more in isColorInherited.

  • title : string | Function

    A meaningful title for the command displayed in a dropdown list of possible commands. It can be a string or a callback function returning a string.