Important changes to Tiny Cloud pricing > Find out more

Editor command identifiers

The complete list of exposed editor commands.

Contribute to this page

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 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:

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.
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.
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.
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.
ToggleSidebar Closes the currrent sidebar, or toogles the sidebar if the sidebar name is provided as a value (<sidebar-name>).
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>).

Examples

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('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('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>')

Plugin Commands

Commands are available for the following plugins:

Advanced Code

The following command requires the Advanced Code (advcode) plugin.

Command Description
mceCodeEditor Opens the code editor dialog.

Example

tinymce.activeEditor.execCommand('mceCodeEditor');

Advanced Lists

The following commands require the Advanced Lists (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.

Examples

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) plugin.

Command Description
mceAdvancedTableSort Opens the Advanced Table Sort Dialog for the current selection or cursor location.
mceSortTableAdvanced Performs an Advanced Table Sort. See below for details.
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.

mceSortTableAdvanced accepts an object with the following value pairs:

  • sortby - 'row' or 'column'
  • roworcol - 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'
  • order - 'ascending' or 'descending'

Examples

tinymce.activeEditor.execCommand('mceAdvancedTableSort')
tinymce.activeEditor.execCommand('mceSortTableAdvanced', { sortby: 'row' ; roworcol: '2' ; sort: 'table' ; order: 'ascending' ; })
tinymce.activeEditor.execCommand('mceSortTableByColumnAsc')
tinymce.activeEditor.execCommand('mceSortTableByColumnDesc')
tinymce.activeEditor.execCommand('mceSortTableByRowAsc')
tinymce.activeEditor.execCommand('mceSortTableByRowDesc')

Anchor

The following command requires the Anchor (anchor) plugin.

Command Description
mceAnchor Opens the insert/edit anchor dialog.

Example

tinymce.activeEditor.execCommand('mceAnchor');

Autoresize

The following command requires the Autoresize (autoresize) plugin.

Command Description
mceAutoResize Auto resizes the editor to the contents.

Example

tinymce.activeEditor.execCommand('mceAutoResize');

Case Change

The following commands require the Case Change (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

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

Character Map

The following command requires the Character Map (charmap) plugin.

Command Description
mceShowCharmap Opens the character map dialog.

Example

tinymce.activeEditor.execCommand('mceShowCharmap');

Code

The following command requires the Code (code) plugin.

Command Description
mceCodeEditor Opens the code editor dialog.

Example

tinymce.activeEditor.execCommand('mceCodeEditor');

Code Sample

The following command requires the Code Sample (codesample) plugin.

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

Example

tinymce.activeEditor.execCommand('CodeSample');

Comments

The following commands require the Comments (tinycomments) 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

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

Directionality

The following commands require the Directionality (directionality) plugin.

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

Examples

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

Format Painter

The following commands require the Format Painter (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

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

Full Page

The following command requires the Full Page (fullpage) plugin.

Command Description
mceFullPageProperties Opens the Fullpage dialog.

Example

tinymce.activeEditor.execCommand('mceFullPageProperties');

Full Screen

The following command requires the Full Screen (fullscreen) plugin.

Command Description
mceFullScreen Toggles full screen mode.

Example

tinymce.activeEditor.execCommand('mceFullScreen');

Help

The following command requires the Help (help) plugin.

Command Description
mceHelp Opens the editor Help dialog.

Example

tinymce.activeEditor.execCommand('mceHelp');

Image

The following command requires the Image (image) plugin.

Command Description
mceImage Opens the insert/edit image dialog.

Example

tinymce.activeEditor.execCommand('mceImage');

Image Tools

The following commands require the Image Tools (imagetools) 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

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) plugin.

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

Examples

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

Link

The following command requires the Link (link) plugin.

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

Example

tinymce.activeEditor.execCommand('mceLink');

Lists

The following commands require the 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

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) plugin.

Command Description
mceMedia Opens the insert/edit media dialog.

Example

tinymce.activeEditor.execCommand('mceMedia');

Nonbreaking Space

The following command requires the Nonbreaking Space (nonbreaking) plugin.

Command Description
mceNonBreaking Inserts a non breaking space at the cursor location or inplace of the current selection.

Example

tinymce.activeEditor.execCommand('mceNonBreaking');

Page Break

The following command requires the Page Break (pagebreak) plugin.

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

Example

tinymce.activeEditor.execCommand('mcePageBreak');

Paste

The following commands require the 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

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

Permanent Pen

The following commands require the Permanent Pen (permanentpen) plugin.

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

Examples

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

PowerPaste

The following command requires the PowerPaste (powerpaste) plugin.

Command Description
mceTogglePlainTextPaste Toggles paste as plain text.

Example

tinymce.activeEditor.execCommand('mceTogglePlainTextPaste');

Preview

The following command requires the Preview (preview) plugin.

Command Description
mcePreview Displays a preview of the editor contents.

Example

tinymce.activeEditor.execCommand('mcePreview');

Print

The following command requires the Print (print) plugin.

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

Example

tinymce.activeEditor.execCommand('mcePrint');

Save

The following commands require the 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

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

Search and Replace

The following command requires the Search and Replace (searchreplace) plugin.

Command Description
SearchReplace Opens the search and replace dialog.

Example

tinymce.activeEditor.execCommand('SearchReplace');

Spell Checker

The following command requires the Spell Checker (spellchecker) plugin.

Command Description
mceSpellCheck Toggles spellchecking on/off.

Example

tinymce.activeEditor.execCommand('mceSpellCheck');

Table

The following commands require the Table (table) plugin.

Command Description
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 into the clipboard.
mceTableCopyRow Copies the current row into the clipboard.
mceTablePasteRowBefore Paste the clipboard row before the current row.
mceTablePasteRowAfter Paste the clipboard row after the current row.
mceTableDelete Deletes the current table.
mceInsertTable Opens the insert/edit table dialog.
mceTableProps Opens the Table Properties dialog.
mceTableRowProps Opens the table row properties dialog.
mceTableCellProps Opens the table cell properties dialog.

Examples

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('mceTableCopyRow');
tinymce.activeEditor.execCommand('mceTablePasteRowBefore');
tinymce.activeEditor.execCommand('mceTablePasteRowAfter');
tinymce.activeEditor.execCommand('mceTableDelete');
tinymce.activeEditor.execCommand('mceInsertTable');
tinymce.activeEditor.execCommand('mceTableProps');
tinymce.activeEditor.execCommand('mceTableRowProps');
tinymce.activeEditor.execCommand('mceTableCellProps');

Template

The following command requires the Template (template) plugin.

Command Description
mceInsertTemplate Inserts a template the value should be the template HTML to process and insert.

Example

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

Table of Contents

The following commands require the Table of Contents (toc) plugin.

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

Examples

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

Visual Blocks

The following command requires the Visual Blocks (visualblocks) plugin.

Command Description
mceVisualBlocks Toggles visual blocks on/off.

Example

tinymce.activeEditor.execCommand('mceVisualBlocks');

Visual Characters

The following command requires the Visual Characters (visualchars) plugin.

Command Description
mceVisualChars Toggles visual characters on/off.

Example

tinymce.activeEditor.execCommand('mceVisualChars');

Editor Management Commands

The following commands are used to manage editor instances.

For example:

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 if the editor is visible or show if it is not visible.

Can't find what you're looking for? Let us know.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.