---
title: "Commands Available for TinyMCE"
description: "The complete list of exposed editor commands."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/editor-command-identifiers/"
md_url: "https://www.tiny.cloud/docs/tinymce/5/editor-command-identifiers/index.md"
version: "5"
last_updated: "2024-04-09T10:06:54Z"
tokens: 10288
---
Important This page documents TinyMCE 5. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../latest/editor-command-identifiers/).
# Commands Available for TinyMCE

## Overview

- [Executable commands](#executablecommands)

  - [Listing core and plugin editor commands](#listingcoreandplugineditorcommands)
  - [Core Editor commands](#coreeditorcommands)
  - [Plugin Commands](#plugincommands)
  - [Editor Management Commands](#editormanagementcommands)
- [Query command states](#querycommandstates)

  - [Listing core and plugin query command states](#listingcoreandpluginquerycommandstates)
  - [Available query command states](#availablequerycommandstates)
- [Query command values](#querycommandvalues)

  - [Listing core and plugin Query command values](#listingcoreandpluginquerycommandvalues)
  - [Available Query command values](#availablequerycommandvalues)
  - [Query command values: Table plugin](#querycommandvaluestableplugin)

## Executable commands

The following tables show the existing editor commands. These commands are provided by `tinymce` and not by the browser’s internal commands. These commands can be executed using the [execCommand](../apis/tinymce.editor/#execCommand) function.

### Listing core and plugin editor commands

To retrieve a list of avaliable commands from the active editor, run the following command from the browser console:

```js
tinymce.activeEditor.editorCommands.commands.exec;
```

### Core Editor commands

The commands on the following table are provided by the TinyMCE editor and do not require any plugins to be enabled.

| Command | Description |
| --- | --- |
| Bold | Toggles bold formatting to selection. |
| Italic | Toggles italic formatting to selection. |
| Underline | Toggles underline formatting to selection. |
| Strikethrough | Toggles strikethough formatting to selection. |
| Superscript | Toggles superscript formatting to selection. |
| Subscript | Toggles subscript formatting to selection. |
| Cut | Cuts the selected contents and puts in into users clipboard. |
| Copy | Copies the selected contents and puts in into users clipboard. |
| Lang | Sets the language of the current selection. The value passed in should be a language spec described in [Content appearance options - `content_langs`](../content-localization/#content_langs). |
| Paste | Pastes the current clipboard contents into the editor. |
| mceInsertLink | Inserts a link at the current selection. The value is the URL to add to the link(s). |
| Unlink | Removes any links from the current selection. |
| JustifyLeft | Left aligns the current text block/image. |
| JustifyCenter | Center aligns the current text block/image. |
| JustifyRight | Right aligns the current text block/image. |
| JustifyFull | Full aligns the current text block/image. |
| JustifyNone | Removes any alignment to the selected text. |
| ForeColor | Changes the text color of the text. The value passed in should be the color. |
| HiliteColor | Changes the background color of the text. The value passed in should be the color. |
| FontName | Font name to apply to the text. The value passed in should be the font family name. |
| FontSize | Font size of the text. The value passed in should be a valid CSS font size. |
| LineHeight | Sets the line height of the text. The value passed in should be a valid CSS line height. NOTE: This feature is only available for TinyMCE 5.5 and later. |
| mceApplyTextcolor | Applies text color or background color to the current selection. Requires an argument of either `'hilitecolor'` or `'forecolor'`, and the value of the color. |
| mceRemoveTextcolor | Removes the text color or background color from the current selection. Requires an argument of either `'hilitecolor'` or `'forecolor'`. |
| RemoveFormat | Removes any formats from the current selection. |
| mceBlockQuote | Wraps the selected text blocks into a block quote. |
| FormatBlock | Toggles the format of the current selection. The value passed in should be the format name. If no format is specified, the paragraph (`<p>`) format will be toggled. For a list of options, see: [Content formatting options - Built-in formats](../content-formatting/#built-informats). |
| mceInsertContent | Inserts contents at the current selection. The value passed in should be the contents to be inserted. |
| mceReplaceContent | Replaces the current selection. The value passed in should be the new content. |
| mceSetContent | Sets the contents of the editor. The value is the contents to set as the editor contents. |
| mceToggleFormat | Toggles a specified format by name. The value is the name of the format to toggle. For a list of options, see: [Content formatting options - Built-in formats](../content-formatting/#built-informats). |
| ToggleSidebar | Closes the currrent sidebar, or toogles the sidebar if the sidebar name is provided as a value (`<sidebar-name>`). |
| ToggleToolbarDrawer | Toggles the Toolbar Drawer. For information on toolbars, see: [User interface options - Toolbar](../editor-appearance/#toolbar). NOTE: This feature is only available for TinyMCE 5.5 and later. |
| Indent | Indents the current selection. |
| Outdent | Outdents the current selection. |
| InsertHorizontalRule | Inserts a horizontal rule at the cursor location or inplace of the current selection. |
| InsertLineBreak | Adds a line break `<br/>` at the current cursor or selection. |
| mceInsertNewLine | Adds a new line at the current cursor or selection, such as splitting the current paragraph element. |
| mceInsertRawHTML | Inserts the RAW HTML passed as a value, overwriting the current selection or at the cursor position. **Warning**: This command allows dangerous `<script>` elements to be added to and executed in the editor. |
| mceToggleVisualAid | Toggles the visual aids for: tables without borders and anchors. |
| SelectAll | Selects all content in the editor. |
| Delete | Deletes the current selection from the editor. |
| ForwardDelete | Deletes the current selection or the character to the right of the cursor for a collapsed selection. |
| mceNewDocument | Removes all contents of the editor. |
| Redo | Redoes the last change to the editor. |
| Undo | Undoes the last change to the editor. |
| mceAddUndoLevel | Adds an undo level. |
| mceEndUndoLevel | Adds an undo level. |
| mceCleanup | Copies the current editor content and sets the content using the copy. |
| mceSelectNode | Selects a node in the editor. The target node is passed as the value (`<DOM_node>`). |
| mceSelectNodeDepth | Selects the parent DOM node 'n' levels above the current node. |
| mceRemoveNode | Removes the current node or the target node passed as the value (`<DOM_node>`). |
| mceFocus | Focuses and activates the editor. Places DOM focus inside the editor and also sets the editor as the active editor instance on the page. NOTE: This feature is only available for TinyMCE 5.9 and later. |

**Examples**

```js
tinymce.activeEditor.execCommand('Bold');
tinymce.activeEditor.execCommand('Italic');
tinymce.activeEditor.execCommand('Underline');
tinymce.activeEditor.execCommand('Strikethrough');
tinymce.activeEditor.execCommand('Superscript');
tinymce.activeEditor.execCommand('Subscript');
tinymce.activeEditor.execCommand('Cut');
tinymce.activeEditor.execCommand('Copy');
tinymce.activeEditor.execCommand('Paste');
tinymce.activeEditor.execCommand('mceInsertLink', false, 'https://www.tiny.cloud');
tinymce.activeEditor.execCommand('Unlink');
tinymce.activeEditor.execCommand('JustifyLeft');
tinymce.activeEditor.execCommand('JustifyCenter');
tinymce.activeEditor.execCommand('JustifyRight');
tinymce.activeEditor.execCommand('JustifyFull');
tinymce.activeEditor.execCommand('JustifyNone');
tinymce.activeEditor.execCommand('ForeColor', false, '#FF0000');
tinymce.activeEditor.execCommand('HiliteColor', false, '#FF0000');
tinymce.activeEditor.execCommand('FontName', false, 'courier new');
tinymce.activeEditor.execCommand('FontSize', false, '30px');
tinymce.activeEditor.execCommand('LineHeight', false, '1.4');
tinymce.activeEditor.execCommand('mceApplyTextcolor', 'hilitecolor', '#FF0000');
tinymce.activeEditor.execCommand('mceRemoveTextcolor', 'hilitecolor');
tinymce.activeEditor.execCommand('RemoveFormat');
tinymce.activeEditor.execCommand('mceBlockQuote');
tinymce.activeEditor.execCommand('FormatBlock', false, 'bold');
tinymce.activeEditor.execCommand('mceInsertContent', false, 'My new content');
tinymce.activeEditor.execCommand('mceReplaceContent', false, 'My replacement content');
tinymce.activeEditor.execCommand('mceSetContent', false, 'My content');
tinymce.activeEditor.execCommand('mceToggleFormat', false, 'bold');
tinymce.activeEditor.execCommand('ToggleSidebar');  /* OR */
tinymce.activeEditor.execCommand('ToggleSidebar', false, '<sidebar-name>');
tinymce.activeEditor.execCommand('ToggleToolbarDrawer');
tinymce.activeEditor.execCommand('Indent');
tinymce.activeEditor.execCommand('Outdent');
tinymce.activeEditor.execCommand('InsertHorizontalRule');
tinymce.activeEditor.execCommand('InsertLineBreak');
tinymce.activeEditor.execCommand('mceInsertNewLine');
tinymce.activeEditor.execCommand('mceInsertRawHTML', false, '<p>Hello, World!</p>');
tinymce.activeEditor.execCommand('mceToggleVisualAid');
tinymce.activeEditor.execCommand('SelectAll');
tinymce.activeEditor.execCommand('Delete');
tinymce.activeEditor.execCommand('ForwardDelete');
tinymce.activeEditor.execCommand('mceNewDocument');
tinymce.activeEditor.execCommand('Redo');
tinymce.activeEditor.execCommand('Undo');
tinymce.activeEditor.execCommand('mceAddUndoLevel');
tinymce.activeEditor.execCommand('mceEndUndoLevel');
tinymce.activeEditor.execCommand('mceCleanup');
tinymce.activeEditor.execCommand('mceSelectNode', false, '<DOM_node>');
tinymce.activeEditor.execCommand('mceSelectNodeDepth', false, 2); // For two nodes up.
tinymce.activeEditor.execCommand('mceRemoveNode'); /* OR */
tinymce.activeEditor.execCommand('mceRemoveNode', false, '<DOM_node>');
tinymce.activeEditor.execCommand('mceFocus');
```

### Plugin Commands

Commands are available for the following plugins:

- [Advanced Code](#advancedcode)
- [Advanced Lists](#advancedlists)
- [Advanced Tables](#advancedtables)
- [Anchor](#anchor)
- [Autoresize](#autoresize)
- [Case Change](#casechange)
- [Character Map](#charactermap)
- [Code](#code)
- [Code Sample](#codesample)
- [Comments](#comments)
- [Directionality](#directionality)
- [Emoticons](#emoticons)
- [Export](#export)
- [Format Painter](#formatpainter)
- [Full Page](#fullpage)
- [Full Screen](#fullscreen)
- [Help](#help)
- [Image](#image)
- [Image Tools](#imagetools)
- [Insert Date/Time](#insertdatetime)
- [Link](#link)
- [Lists](#lists)
- [Media](#media)
- [Nonbreaking Space](#nonbreakingspace)
- [Page Break](#pagebreak)
- [Paste](#pasteorpowerpaste)
- [Permanent Pen](#permanentpen)
- [PowerPaste](#powerpaste)
- [Preview](#preview)
- [Print](#print)
- [Save](#save)
- [Search and Replace](#searchandreplace)
- [Spell Checker](#spellchecker)
- [Spell Checker Pro](#spellcheckerpro)
- [Table](#table)
- [Template](#template)
- [Table of Contents](#tableofcontents)
- [Visual Blocks](#visualblocks)
- [Visual Characters](#visualcharacters)
- [Word Count](#wordcount)

#### Advanced Code

The following command requires the [Advanced Code (`advcode`)](../advcode/) plugin.

| Command | Description |
| --- | --- |
| mceCodeEditor | Opens the code editor dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceCodeEditor');
```

#### Advanced Lists

The following commands require the [Advanced Lists (`advlist`)](../advlist/) plugin.

| Command | Description |
| --- | --- |
| ApplyOrderedListStyle | Converts the current selection to an ordered list. Accepts an object specifing the list type. |
| ApplyUnorderedListStyle | Converts the current selection to an unordered list. Accepts an object specifing the list type. |

For information on available list types, see: [MDN web docs - list-style-type](https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type#Values).

**Examples**

```js
tinymce.activeEditor.execCommand('ApplyOrderedListStyle', false, {
  'list-style-type': 'disc'
});
tinymce.activeEditor.execCommand('ApplyUnorderedListStyle', false, {
  'list-style-type': 'decimal'
});
```

#### Advanced Tables

The following commands require the [Advanced Tables (`advtable`)](../advtable/) plugin.

| Command | Description |
| --- | --- |
| mceAdvancedTableSort | Opens the Advanced Table Sort Dialog for the current selection or cursor location. |
| mceSortTableAdvanced | Performs an Advanced Table Sort. For details, see [Using `mceSortTableAdvanced`](#usingmcesorttableadvanced). |
| mceSortTableByColumnAsc | Sorts the current table ascending by column based on the current cursor position or selection. |
| mceSortTableByColumnDesc | Sorts the current table descending by column based on the current cursor position or selection. |
| mceSortTableByRowAsc | Sorts the current table ascending by row based on the current cursor position or selection. |
| mceSortTableByRowDesc | Sorts the current table descending by row based on the current cursor position or selection. |
| mceTableToggleSeries | Toggles a series column on the selected table. For details, see [Using `mceTableToggleSeries`](#usingmcetabletoggleseries). NOTE: This feature is only available for TinyMCE 5.9 and later. |

**Examples**

```js
tinymce.activeEditor.execCommand('mceAdvancedTableSort')
tinymce.activeEditor.execCommand('mceSortTableAdvanced', false, { sortby: 'row', roworcol: '2', sort: 'table', order: 'ascending' })
tinymce.activeEditor.execCommand('mceSortTableByColumnAsc')
tinymce.activeEditor.execCommand('mceSortTableByColumnDesc')
tinymce.activeEditor.execCommand('mceSortTableByRowAsc')
tinymce.activeEditor.execCommand('mceSortTableByRowDesc')
tinymce.activeEditor.execCommand('mceTableToggleSeries', false, { name: 'numeric' })
```

### Using `mceSortTableAdvanced`

`mceSortTableAdvanced` accepts an object with the following key-value pairs:

| Name | Value | Requirement | Description |
| --- | --- | --- | --- |
| sortby | `'row'` or `'column'` | Required |  |
| roworcol | `number` | Required | A zero-indexed integer in a string representing the row from the top of the table or column from the left of the table. |
| sort | `'row'`, `'column'`, `'selection'`, or `'table'` | Required |  |
| order | `'ascending'` or `'descending'` | Required |  |

### Using `mceTableToggleSeries`

`mceTableToggleSeries` accepts an object with the following key-value pairs:

| Name | Value | Requirement | Description |
| --- | --- | --- | --- |
| name | `string` | Required | Specifies the series to toggle. Series and their associated names are configured using the [`advtable_value_series` option](../advtable/#advtable_value_series). |

If the table already has a series column that uses the series specified in `name`, the series column will be removed from the table. Otherwise, a new series column will be created, replacing any other series column that may already be in the table.

#### Anchor

The following command requires the [Anchor (`anchor`)](../anchor/) plugin.

| Command | Description |
| --- | --- |
| mceAnchor | Opens the insert/edit anchor dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceAnchor');
```

#### Autoresize

The following command requires the [Autoresize (`autoresize`)](../autoresize/) plugin.

| Command | Description |
| --- | --- |
| mceAutoResize | Auto resizes the editor to the contents. |

**Example**

```js
tinymce.activeEditor.execCommand('mceAutoResize');
```

#### Case Change

The following commands require the [Case Change (`casechange`)](../casechange/) plugin.

| Command | Description |
| --- | --- |
| mceLowerCase | Converts selected text to lower-case. |
| mceTitleCase | Converts selected text to title-case. |
| mceUpperCase | Converts selected text to upper-case. |

**Examples**

```js
tinymce.activeEditor.execCommand('mceLowerCase');
tinymce.activeEditor.execCommand('mceTitleCase');
tinymce.activeEditor.execCommand('mceUpperCase');
```

#### Character Map

The following command requires the [Character Map (`charmap`)](../charmap/) plugin.

| Command | Description |
| --- | --- |
| mceShowCharmap | Opens the character map dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceShowCharmap');
```

#### Code

The following command requires the [Code (`code`)](../code/) plugin.

| Command | Description |
| --- | --- |
| mceCodeEditor | Opens the code editor dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceCodeEditor');
```

#### Code Sample

The following command requires the [Code Sample (`codesample`)](../codesample/) plugin.

| Command | Description |
| --- | --- |
| CodeSample | Opens the Code Sample dialog at the cursor position or converts the current selection to a `<code>` block. |

**Example**

```js
tinymce.activeEditor.execCommand('CodeSample');
```

#### Comments

The following commands require the [Comments (`tinycomments`)](../comments/) plugin.

| Command | Description |
| --- | --- |
| tc-delete-conversation-at-cursor | Attempts to delete the comment at the current cursor position. A confirmation dialog will be shown prior to deletion. |
| tc-try-delete-all-conversations | Attempts to delete all comments in the editor. A confirmation dialog will be shown prior to deletion. |

**Examples**

```js
tinymce.activeEditor.execCommand('tc-delete-conversation-at-cursor');
tinymce.activeEditor.execCommand('tc-try-delete-all-conversations');
```

#### Directionality

The following commands require the [Directionality (`directionality`)](../directionality/) plugin.

| Command | Description |
| --- | --- |
| mceDirectionLTR | Changes the directionality to LTR. |
| mceDirectionRTL | Changes the directionality to RTL. |

**Examples**

```js
tinymce.activeEditor.execCommand('mceDirectionLTR');
tinymce.activeEditor.execCommand('mceDirectionRTL');
```

#### Emoticons

The following commands require the [Emoticons (`emoticons`)](../emoticons/) plugin.

| Command | Description |
| --- | --- |
| mceEmoticons | Opens the Emoticons dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceEmoticons');
```

#### Export

The following commands require the [Export (`export`)](../export/) plugin.

| Command | Description |
| --- | --- |
| mceExportDownload | Converts the editor content using the specified exporter format and downloads the converted content. |

> **Note:** There are no settings available when using the 'clientpdf' format.
**Examples**

```js
tinymce.activeEditor.execCommand('mceExportDownload', false, {
  format: 'clientpdf',
  settings: {}
});
```

#### Format Painter

The following commands require the [Format Painter (`formatpainter`)](../formatpainter/) plugin.

| Command | Description |
| --- | --- |
| mceRetrieveFormats | Retrieves the formats from the current selection. |
| mcePaintFormats | Applies the formats retrieved using `mceRetrieveFormats` to the current selection. |
| mceToggleFormatPainter | Toggles the Format Painter. |

**Examples**

```js
tinymce.activeEditor.execCommand('mceRetrieveFormats');
tinymce.activeEditor.execCommand('mcePaintFormats');
tinymce.activeEditor.execCommand('mceToggleFormatPainter');
```

#### Full Page

> **Important:** The Full Page plugin (`fullpage`) was deprecated with the release of TinyMCE 5.9. For details, see [the Full Page plugin deprecation notice](../release-notes59/#thefullpagefullpageplugin). The Full Page plugin will be removed in TinyMCE 6.0.
The following command requires the [Full Page (`fullpage`)](../fullpage/) plugin.

| Command | Description |
| --- | --- |
| mceFullPageProperties | Opens the Fullpage dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceFullPageProperties');
```

#### Full Screen

The following command requires the [Full Screen (`fullscreen`)](../fullscreen/) plugin.

| Command | Description |
| --- | --- |
| mceFullScreen | Toggles full screen mode. |

**Example**

```js
tinymce.activeEditor.execCommand('mceFullScreen');
```

#### Help

The following command requires the [Help (`help`)](../help/) plugin.

| Command | Description |
| --- | --- |
| mceHelp | Opens the editor Help dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceHelp');
```

#### Image

The following command requires the [Image (`image`)](../image/) plugin.

| Command | Description |
| --- | --- |
| mceImage | Opens the insert/edit image dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceImage');
```

#### Image Tools

The following commands require the [Image Tools (`imagetools`)](../editimage/) plugin.

| Command | Description |
| --- | --- |
| mceEditImage | Opens the image tools editing dialog. |
| mceImageRotateRight | Rotates selected image 90 degrees clockwise. |
| mceImageRotateLeft | Rotates selected image 90 degrees counter clockwise. |
| mceImageFlipVertical | Flips selected image vertically. |
| mceImageFlipHorizontal | Flips selected image horizontally. |

**Examples**

```js
tinymce.activeEditor.execCommand('mceEditImage');
tinymce.activeEditor.execCommand('mceImageRotateRight');
tinymce.activeEditor.execCommand('mceImageRotateLeft');
tinymce.activeEditor.execCommand('mceImageFlipVertical');
tinymce.activeEditor.execCommand('mceImageFlipHorizontal');
```

#### Insert Date/Time

The following commands require the [Insert Date/Time (`insertdatetime`)](../insertdatetime/) plugin.

| Command | Description |
| --- | --- |
| mceInsertDate | Inserts the current date as a human readable string. |
| mceInsertTime | Inserts the current time as a human readable string. |

**Examples**

```js
tinymce.activeEditor.execCommand('mceInsertDate');
tinymce.activeEditor.execCommand('mceInsertTime');
```

#### Link

The following command requires the [Link (`link`)](../link/) plugin.

| Command | Description |
| --- | --- |
| mceLink | Opens the Link or Quicklink Dialog at the current cursor position or for the current selection. |

**Example**

```js
tinymce.activeEditor.execCommand('mceLink');
```

#### Lists

The following commands require the [Lists (`lists`)](../lists/) plugin.

| Command | Description |
| --- | --- |
| InsertDefinitionList | Inserts a definition list into the editor. |
| InsertOrderedList | Inserts an ordered list into the editor. |
| InsertUnorderedList | Inserts an unordered list into the editor. |
| RemoveList | Removes the list elements from the selection. |

**Examples**

```js
tinymce.activeEditor.execCommand('InsertDefinitionList', false, {
  'list-item-attributes': {class: 'mylistitemclass'},
  'list-attributes': {id: 'mylist'}
});
tinymce.activeEditor.execCommand('InsertOrderedList', false, {
  'list-style-type': 'decimal',
  'list-item-attributes': {class: 'mylistitemclass'},
  'list-attributes': {id: 'mylist'}
});
tinymce.activeEditor.execCommand('InsertUnorderedList', false, {
  'list-style-type': 'disc',
  'list-item-attributes': {class: 'mylistitemclass'},
  'list-attributes': {id: 'mylist'}
});
tinymce.activeEditor.execCommand('RemoveList');
```

#### Media

The following command requires the [Media (`media`)](../media/) plugin.

| Command | Description |
| --- | --- |
| mceMedia | Opens the insert/edit media dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceMedia');
```

#### Nonbreaking Space

The following command requires the [Nonbreaking Space (`nonbreaking`)](../nonbreaking/) plugin.

| Command | Description |
| --- | --- |
| mceNonBreaking | Inserts a non breaking space at the cursor location or overwrites the current selection. |

**Example**

```js
tinymce.activeEditor.execCommand('mceNonBreaking');
```

#### Page Break

The following command requires the [Page Break (`pagebreak`)](../pagebreak/) plugin.

| Command | Description |
| --- | --- |
| mcePageBreak | Inserts a virtual page break (`<!-- pagebreak -->`) at the cursor location or overwrites the current selection. |

**Example**

```js
tinymce.activeEditor.execCommand('mcePageBreak');
```

#### Paste

The following commands require the [Paste (`paste`)](../paste/) plugin.

| Command | Description |
| --- | --- |
| mceInsertClipboardContent | Triggers a paste event at the cursor location or over the current selection. The command requires an object with: `content` containing the HTML content, or `text` containing plain text. |
| mceTogglePlainTextPaste | Toggles paste as plain text. |

**Examples**

```js
tinymce.activeEditor.execCommand('mceInsertClipboardContent', false, {
  content: '<p>Hello, World!</p>'
});
tinymce.activeEditor.execCommand('mceTogglePlainTextPaste');
```

#### Permanent Pen

The following commands require the [Permanent Pen (`permanentpen`)](../permanentpen/) plugin.

| Command | Description |
| --- | --- |
| mceConfigurePermanentPen | Opens the Permanent Pen dialog. |
| mceTogglePermanentPen | Toggles Permanent Pen. |

**Examples**

```js
tinymce.activeEditor.execCommand('mceConfigurePermanentPen');
tinymce.activeEditor.execCommand('mceTogglePermanentPen');
```

#### PowerPaste

The following command requires the [PowerPaste (`powerpaste`)](../introduction-to-powerpaste/) plugin.

| Command | Description |
| --- | --- |
| mceTogglePlainTextPaste | Toggles paste as plain text. |

**Example**

```js
tinymce.activeEditor.execCommand('mceTogglePlainTextPaste');
```

#### Preview

The following command requires the [Preview (`preview`)](../preview/) plugin.

| Command | Description |
| --- | --- |
| mcePreview | Displays a preview of the editor contents. |

**Example**

```js
tinymce.activeEditor.execCommand('mcePreview');
```

#### Print

The following command requires the [Print (`print`)](../print/) plugin.

| Command | Description |
| --- | --- |
| mcePrint | Opens the browser’s print dialog for the current page. |

**Example**

```js
tinymce.activeEditor.execCommand('mcePrint');
```

#### Save

The following commands require the [Save (`save`)](../save/) plugin.

| Command | Description |
| --- | --- |
| mceCancel | Resets the editor content to the last save point created with `mceSave`, the *save* toolbar button, or the **Save** menu item. This command will reset the editor content to the initial state if no save points exist. |
| mceSave | Saves the current editor contents. |

**Examples**

```js
tinymce.activeEditor.execCommand('mceCancel');
tinymce.activeEditor.execCommand('mceSave');
```

#### Search and Replace

The following command requires the [Search and Replace (`searchreplace`)](../searchreplace/) plugin.

| Command | Description |
| --- | --- |
| SearchReplace | Opens the search and replace dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('SearchReplace');
```

#### Spell Checker

The following command requires the [Spell Checker (`spellchecker`)](../spellchecker/) plugin.

> **Important:** The **free** TinyMCE Spell Checker plugin (`spellchecker`) was deprecated with the release of TinyMCE 5.4. For details, see [the free TinyMCE Spell Checker plugin deprecation notice](../release-notes54/#thefreetinymcespellcheckerplugin). The free Spell Checker plugin will be removed in TinyMCE 6.0.

| Command | Description |
| --- | --- |
| mceSpellCheck | Toggles spellchecking on/off. |

**Example**

```js
tinymce.activeEditor.execCommand('mceSpellCheck');
```

#### Spell Checker Pro

The following commands require the [Spell Checker Pro (`tinymcespellchecker`)](../introduction-to-tiny-spellchecker/) plugin.

> **Note:** This feature is only available for TinyMCE 5.7 and later.

| Command | Description |
| --- | --- |
| mceSpellcheckEnable | Turns spellchecking on. |
| mceSpellcheckDisable | Turns spellchecking off. |
| mceSpellcheckDialog | Opens the spellchecking dialog. |
| mceSpellcheckDialogClose | Closes the spellchecking dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceSpellcheckEnable');
tinymce.activeEditor.execCommand('mceSpellcheckDisable');
tinymce.activeEditor.execCommand('mceSpellcheckDialog');
tinymce.activeEditor.execCommand('mceSpellcheckDialogClose');
```

#### Table

The following commands require the [Table (`table`)](../table/) plugin.

> **Note:** Table row and table column cut, copy, and paste commands work with
> TinyMCE’s internal table clipboard, not the user’s system clipboard.

| Command | Description |
| --- | --- |
| mceTableSizingMode | When `table_sizing_mode` is set to `'auto'`, this command sets the sizing mode of the currently selected table. For information on table sizing modes, see: [Table plugin - `table_sizing_mode`](../table/#table_sizing_mode). NOTE: This feature is only available for TinyMCE 5.4 and later. |
| mceTableApplyCellStyle | Applies the specified styles to the selected cells. The following styles can be changed with this command: `background-color`, `border-color`, `border-style`, and `border-width`. Providing an empty value for a style will remove the style, such as `{ 'background-color': '' }`. NOTE: This feature is only available for TinyMCE 5.4 and later. |
| mceTableSplitCells | Splits the current merged table cell. |
| mceTableMergeCells | Merges the selected cells. |
| mceTableInsertRowBefore | Inserts a row before the current row. |
| mceTableInsertRowAfter | Inserts a row after the current row. |
| mceTableInsertColBefore | Inserts a column before the current column. |
| mceTableInsertColAfter | Inserts a column after the current column. |
| mceTableDeleteCol | Deletes the current column. |
| mceTableDeleteRow | Deletes the current row. |
| mceTableCutRow | Cuts the current row to the TinyMCE clipboard. |
| mceTableCutCol | Cuts the current column to the TinyMCE clipboard. NOTE: This feature is only available for TinyMCE 5.4 and later. |
| mceTableCopyRow | Copies the current row to the TinyMCE clipboard. |
| mceTableCopyCol | Copies the current column to the TinyMCE clipboard. NOTE: This feature is only available for TinyMCE 5.4 and later. |
| mceTablePasteRowBefore | Paste the TinyMCE clipboard row before the current row. |
| mceTablePasteRowAfter | Paste the TinyMCE clipboard row after the current row. |
| mceTablePasteColBefore | Paste the TinyMCE clipboard column before the current row. NOTE: This feature is only available for TinyMCE 5.4 and later. |
| mceTablePasteColAfter | Paste the TinyMCE clipboard column after the current row. NOTE: This feature is only available for TinyMCE 5.4 and later. |
| mceTableDelete | Deletes the current table. |
| mceTableCellToggleClass | Adds a class to all selected cells that do not have it, or removes the class if all of them have it. NOTE: This feature is only available for TinyMCE 5.9 and later. |
| mceTableToggleClass | Adds a class to the selected table, or removes the class if it already exists. NOTE: This feature is only available for TinyMCE 5.9 and later. |
| mceTableToggleCaption | Adds a caption to the selected table, or removes the caption if it already exists. NOTE: This feature is only available for TinyMCE 5.9 and later. |
| mceInsertTable | Opens the insert/edit table dialog or inserts a table without using a dialog if additional arguments are provided (see examples below). |
| mceTableProps | Opens the Table Properties dialog. |
| mceTableRowProps | Opens the table row properties dialog. |
| mceTableCellProps | Opens the table cell properties dialog. |
| mceTableRowType | Changes the current row or rows to the specified type, either: `'header'`, `'body'`, or `'footer'`. The structure of header rows is dependent on the [`table_header_type` option](../table/#table_header_type). NOTE: This feature is only available for TinyMCE 5.4 and later. |
| mceTableColType | Changes all cells in the current column or columns to the specified type, either: `'td'` or `'th'`. NOTE: This feature is only available for TinyMCE 5.4 and later. |
| mceTableCellType | Changes the current cell or cells to the specified type, either: `'td'` or `'th'`. NOTE: This feature is only available for TinyMCE 5.4 and later. |

**Examples**

```js
tinymce.activeEditor.execCommand('mceTableSizingMode', false, 'fixed');
tinymce.activeEditor.execCommand('mceTableSizingMode', false, 'relative');
tinymce.activeEditor.execCommand('mceTableSizingMode', false, 'responsive');
tinymce.activeEditor.execCommand('mceTableApplyCellStyle', false, { 'background-color': 'red', 'border-color': 'blue' });
tinymce.activeEditor.execCommand('mceTableApplyCellStyle', false, { 'background-color': '' }); // removes the current background-color
tinymce.activeEditor.execCommand('mceTableSplitCells');
tinymce.activeEditor.execCommand('mceTableMergeCells');
tinymce.activeEditor.execCommand('mceTableInsertRowBefore');
tinymce.activeEditor.execCommand('mceTableInsertRowAfter');
tinymce.activeEditor.execCommand('mceTableInsertColBefore');
tinymce.activeEditor.execCommand('mceTableInsertColAfter');
tinymce.activeEditor.execCommand('mceTableDeleteCol');
tinymce.activeEditor.execCommand('mceTableDeleteRow');
tinymce.activeEditor.execCommand('mceTableCutRow');
tinymce.activeEditor.execCommand('mceTableCutCol');
tinymce.activeEditor.execCommand('mceTableCopyRow');
tinymce.activeEditor.execCommand('mceTableCopyCol');
tinymce.activeEditor.execCommand('mceTablePasteRowBefore');
tinymce.activeEditor.execCommand('mceTablePasteRowAfter');
tinymce.activeEditor.execCommand('mceTablePasteColBefore');
tinymce.activeEditor.execCommand('mceTablePasteColAfter');
tinymce.activeEditor.execCommand('mceTableDelete');
tinymce.activeEditor.execCommand('mceInsertTable');
tinymce.activeEditor.execCommand('mceInsertTable', false, { rows: 2, columns: 2 });
tinymce.activeEditor.execCommand('mceInsertTable', false, { rows: 3, columns: 2, options: { headerRows: 1 } });
tinymce.activeEditor.execCommand('mceInsertTable', false, { rows: 3, columns: 2, options: { headerRows: 1, headerColumns: 1 } });
tinymce.activeEditor.execCommand('mceTableProps');
tinymce.activeEditor.execCommand('mceTableRowProps');
tinymce.activeEditor.execCommand('mceTableCellProps');
tinymce.activeEditor.execCommand('mceTableToggleClass', false, 'myclass');
tinymce.activeEditor.execCommand('mceTableCellToggleClass', false, 'mycellclass');
tinymce.activeEditor.execCommand('mceTableToggleCaption');
tinymce.activeEditor.execCommand('mceTableRowType', false, { type: 'header' });
tinymce.activeEditor.execCommand('mceTableColType', false, { type: 'th' });
tinymce.activeEditor.execCommand('mceTableCellType', false, { type: 'th' });
```

#### Template

The following command requires the [Template (`template`)](../template/) plugin.

| Command | Description |
| --- | --- |
| mceInsertTemplate | Inserts a template the value should be the template HTML to process and insert. |
| mceTemplate | Opens the Template dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceInsertTemplate', false, '<p>This is my template text.</p>');
tinymce.activeEditor.execCommand('mceTemplate');
```

#### Table of Contents

The following commands require the [Table of Contents (`toc`)](../tableofcontents/) plugin.

| Command | Description |
| --- | --- |
| mceInsertToc | Inserts a Table of Contents into the editor. |
| mceUpdateToc | Updates an existing Table of Contents. |

**Examples**

```js
tinymce.activeEditor.execCommand('mceInsertToc');
tinymce.activeEditor.execCommand('mceUpdateToc');
```

#### Visual Blocks

The following command requires the [Visual Blocks (`visualblocks`)](../visualblocks/) plugin.

| Command | Description |
| --- | --- |
| mceVisualBlocks | Toggles visual blocks on/off. |

**Example**

```js
tinymce.activeEditor.execCommand('mceVisualBlocks');
```

#### Visual Characters

The following command requires the [Visual Characters (`visualchars`)](../visualchars/) plugin.

| Command | Description |
| --- | --- |
| mceVisualChars | Toggles visual characters on/off. |

**Example**

```js
tinymce.activeEditor.execCommand('mceVisualChars');
```

#### Word Count

The following command requires the [Word Count (`wordcount`)](../visualchars/) plugin.

| Command | Description |
| --- | --- |
| mceWordCount | Opens the Word Count summary dialog. |

**Example**

```js
tinymce.activeEditor.execCommand('mceWordCount');
```

### Editor Management Commands

The following commands are used to manage editor instances.

For example:

```js
tinymce.execCommand('mceAddEditor', false, '<editor_id>');
tinymce.execCommand('mceRemoveEditor', false, '<editor_id>');
tinymce.execCommand('mceToggleEditor', false, '<editor_id>');
```

| Command | Description |
| --- | --- |
| mceAddEditor | Converts the specified HTML or DOM element into an editor instance with the specified ID. |
| mceRemoveEditor | Removes an editor instance with the specified ID. |
| mceToggleEditor | Runs mceAddEditor if an editor is not detected for the specified ID, otherwise it runs either [hide](../apis/tinymce.editor/#hide) if the editor is visible or [show](../apis/tinymce.editor/#show) if it is not visible. |

## Query command states

TinyMCE provides the `queryCommandState` API to allow developers to determine the current state of selected content. The query will return `true` if the content is formatted using the same CSS styles and elements used by the corresponding command.

### Listing core and plugin query command states

To retrieve a list of avaliable queryable states from the active editor, run the following command from the browser console:

```js
tinymce.activeEditor.editorCommands.commands.state;
```

### Available query command states

The following command states can be queried using the [queryCommandState](../apis/tinymce.editor/#queryCommandState) API.

| Command | Description |
| --- | --- |
| Bold | Returns `true` if the content is formatted using the same markup as the TinyMCE `Bold` command. |
| InsertDefinitionList | Returns `true` if the content is formatted using the same markup as the TinyMCE `InsertDefinitionList` command. |
| InsertOrderedList | Returns `true` if the content is formatted using the same markup as the TinyMCE `InsertOrderedList` command. |
| InsertUnorderedList | Returns `true` if the content is formatted using the same markup as the TinyMCE `InsertUnorderedList` command. |
| Italic | Returns `true` if the content is formatted using the same markup as the TinyMCE `Italic` command. |
| JustifyCenter | Returns `true` if the content is formatted using the same markup as the TinyMCE `JustifyCenter` command. |
| JustifyFull | Returns `true` if the content is formatted using the same markup as the TinyMCE `JustifyFull` command. |
| JustifyLeft | Returns `true` if the content is formatted using the same markup as the TinyMCE `JustifyLeft` command. |
| JustifyRight | Returns `true` if the content is formatted using the same markup as the TinyMCE `JustifyRight` command. |
| mceBlockQuote | Returns `true` if the content is formatted using the same markup as the TinyMCE `mceBlockQuote` command. |
| Outdent | Returns `true` if the content is formatted using the same markup as the TinyMCE `Outdent` command. |
| Strikethrough | Returns `true` if the content is formatted using the same markup as the TinyMCE `Strikethrough` command. |
| Subscript | Returns `true` if the content is formatted using the same markup as the TinyMCE `Subscript` command. |
| Superscript | Returns `true` if the content is formatted using the same markup as the TinyMCE `Superscript` command. |
| ToggleToolbarDrawer | Returns `true` if the Toolbar Drawer is open. The state can be controlled by the TinyMCE `ToggleToolbarDrawer` command. NOTE: This feature is only available for TinyMCE 5.5 and later. |
| Underline | Returns `true` if the content is formatted using the same markup as the TinyMCE `Underline` command. |

**Examples**

```js
tinymce.activeEditor.queryCommandState('Bold');
tinymce.activeEditor.queryCommandState('InsertDefinitionList');
tinymce.activeEditor.queryCommandState('InsertOrderedList');
tinymce.activeEditor.queryCommandState('InsertUnorderedList');
tinymce.activeEditor.queryCommandState('Italic');
tinymce.activeEditor.queryCommandState('JustifyCenter');
tinymce.activeEditor.queryCommandState('JustifyFull');
tinymce.activeEditor.queryCommandState('JustifyLeft');
tinymce.activeEditor.queryCommandState('JustifyRight');
tinymce.activeEditor.queryCommandState('mceBlockQuote');
tinymce.activeEditor.queryCommandState('Outdent');
tinymce.activeEditor.queryCommandState('Strikethrough');
tinymce.activeEditor.queryCommandState('Subscript');
tinymce.activeEditor.queryCommandState('Superscript');
tinymce.activeEditor.queryCommandState('ToggleToolbarDrawer');
tinymce.activeEditor.queryCommandState('Underline');
```

## Query command values

TinyMCE provides the `queryCommandValue` API to allow developers to determine the current state of selected content. The query will return an object containing the relevant value.

### Listing core and plugin query command values

To retrieve a list of avaliable queryable command values from the active editor, run the following command from the browser console:

```js
tinymce.activeEditor.editorCommands.commands.value;
```

### Available query command values

The following command values can be queried using the [queryCommandValue](../apis/tinymce.editor/#queryCommandValue) API.

| Command | Description |
| --- | --- |
| FontName | Returns the font name of the current selection. |
| FontSize | Returns the font size of the current selection. |
| LineHeight | Returns the line height of the current selection. NOTE: This feature is only available for TinyMCE 5.5 and later. |
| ToggleSidebar | Returns the current state of sidebar (open or closed). |

**Examples**

```js
tinymce.activeEditor.queryCommandValue('FontName');
tinymce.activeEditor.queryCommandValue('FontSize');
tinymce.activeEditor.queryCommandValue('LineHeight');
tinymce.activeEditor.queryCommandValue('ToggleSidebar');
```

### Query command values: Table plugin

The following table-related values can be queried using the [queryCommandValue](../apis/tinymce.editor/#queryCommandValue) API.

| Value | Description |
| --- | --- |
| mceTableRowType | Returns the row type of the current table row, either: `"header"`, `"body"`, or `"footer"`. NOTE: This feature is only available for TinyMCE 5.4 and later. |
| mceTableColType | Returns the column type of the current table column, either: `"td"` or `"th"`. NOTE: This feature is only available for TinyMCE 5.4 and later. |
| mceTableCellType | Returns the cell type of the current table cell, either: `"td"` or `"th"`. NOTE: This feature is only available for TinyMCE 5.4 and later. |

**Examples**

```js
tinymce.activeEditor.queryCommandValue('mceTableCellType');
tinymce.activeEditor.queryCommandValue('mceTableRowType');
tinymce.activeEditor.queryCommandValue('mceTableColType');
```
