Command 
The Command interface manages a collection of commands.
Note
The constructor is not directly accessible. Instead, you can access its methods via the editor.command object.
Example:
editor.command.execute('bold');Instance methods 
add() 
Adds a new command to the collection.
- Parameters: - name- A string that specifies the name of the command. - commandItem- A CommandItem object that specifies the command item to be added. 
- Return value: - None. 
Example:
editor.command.add('removeFormat', {
  execute: () => {
    editor.selection.removeMark();
    editor.history.save();
  },
});delete() 
Removes a command from the collection by its name.
- Parameters: - name- A string that specifies the name of the command. 
- Return value: - None. 
Example:
editor.command.delete('removeFormat');getNames() 
Returns the names of all registered commands.
- Parameters: - None. 
- Return value: - An - Arrayobject containing the names of all commands.
Example:
const names = editor.command.getNames();has() 
Checks whether the specified command exists.
- Parameters: - name- A string that specifies the name of the command. 
- Return value: - trueif the the command exists.- falseif not.
Example:
editor.command.has('helloWorld');getItem() 
Returns a command item by its name.
- Parameters: - name- A string that specifies the name of the command. 
- Return value: - A CommandItem object. 
Example:
const commandItem = editor.command.getItem('bold');isDisabled() 
Checks if the specified command is disabled.
- Parameters: - name- A string that specifies the name of the command. 
- Return value: - trueif the the command is disabled.- falseif not.
Example:
const isDisabled = editor.command.isDisabled('bold');isSelected() 
Checks if the specified command is selected.
- Parameters: - name- A string that specifies the name of the command. 
- Return value: - trueif the command is selected.- falseif not.
Example:
const isSelected = editor.command.isSelected('bold');selectedValues() 
Returns the selected values for the specified command.
- Parameters: - name- A string that specifies the name of the command. 
- Return value: - An - Arrayobject that contains selected values.
Example:
const selectedValues = editor.command.selectedValues('align');execute() 
Executes the specified command.
- Parameters: - name- A string that specifies the name of the command. - valueOptional- An argument required by some commands. For example, the - headingcommand requires a level such as- h1,- h2, and- h3.
- Return value: - None. 
Example:
// Adds bold.
editor.command.execute('bold');
// Changes current block to heading level 1.
editor.command.execute('heading', 'h1');