SlashCommandDefinition
An object describing a single command definition in the configuration.
Properties
-
aliases : Array<string> | undefinedmodule:slash-command/slashcommandconfig~SlashCommandDefinition#aliasesAn 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 | undefinedmodule:slash-command/slashcommandconfig~SlashCommandDefinition#commandNameThe name of the command to be executed if the
executeproperty was not provided, for example, 'blockQuote', 'heading'. Seecommandsto learn more about available commands. -
description : string | undefinedmodule:slash-command/slashcommandconfig~SlashCommandDefinition#descriptionAn optional description for the command. Useful when the title is not descriptive enough.
-
execute : Function | undefinedmodule:slash-command/slashcommandconfig~SlashCommandDefinition#executeA callback function defining custom logic for executing the command. If not provided, the default command's
executeis 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 ifcommandNamewas not passed.This callback gets an
Editorinstance as a parameter. -
icon : string | undefinedmodule:slash-command/slashcommandconfig~SlashCommandDefinition#iconAn 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
viewBoxattribute in the icon source.See
isIconColorInherited. -
id : stringmodule:slash-command/slashcommandconfig~SlashCommandDefinition#idA unique ID matched with the text that follows the slash ("/") character typed by the user, e.g. 'blockQuote', 'heading1'. See
aliasesto learn about slash command aliases that provide a similar functionality. -
isEnabled : Function | undefinedmodule:slash-command/slashcommandconfig~SlashCommandDefinition#isEnabledA callback function defining custom logic to decide if the command should be displayed in the dropdown list. If not provided, the default command's
isEnabledproperty 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
Editorinstance as a parameter. -
isIconColorInherited : boolean | undefinedmodule:slash-command/slashcommandconfig~SlashCommandDefinition#isIconColorInheritedBy default, slash command icons are monochromatic and inherit the color of the text in the editor UI. Setting this property to
falsedisables this inheritance and allows the use of complex (colorful) icons.Learn more in
isColorInherited. -
title : string | Functionmodule:slash-command/slashcommandconfig~SlashCommandDefinition#titleA 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.