SlashCommandDefinition (slash-command)
@ckeditor/ckeditor5-slash-command/src/slashcommandconfig
An object describing a single command definition in the configuration.
Filtering
Properties
-
aliases : Array<string> | undefined
module:slash-command/slashcommandconfig~SlashCommandDefinition#aliases
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
module:slash-command/slashcommandconfig~SlashCommandDefinition#commandName
The name of the command to be executed if the
execute
property was not provided, for example, 'blockQuote', 'heading'. Seecommands
to learn more about available commands. -
description : string | undefined
module:slash-command/slashcommandconfig~SlashCommandDefinition#description
An optional description for the command. Useful when the title is not descriptive enough.
-
execute : Function | undefined
module:slash-command/slashcommandconfig~SlashCommandDefinition#execute
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 ifcommandName
was not passed.This callback gets an
Editor
instance as a parameter. -
icon : string | undefined
module:slash-command/slashcommandconfig~SlashCommandDefinition#icon
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
module:slash-command/slashcommandconfig~SlashCommandDefinition#id
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
module:slash-command/slashcommandconfig~SlashCommandDefinition#isEnabled
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 totrue
. 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
module:slash-command/slashcommandconfig~SlashCommandDefinition#isIconColorInherited
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
module:slash-command/slashcommandconfig~SlashCommandDefinition#title
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.
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.