Examples

editor.execCommand()

Editor object exposes an execCommand method to run commands that manipulate the current editable region.

Syntax

editor.execCommand(command,optionalValue)

command

Specifies the name of the command to execute on the selected section.

value

Some commands need a value to be completed.

Name Description
bold Toggles bold on/off for the selection or at the insertion point.
italic Toggles italics on/off for the selection or at the insertion point.
underline Toggles underline on/off for the selection or at the insertion point.
strike Toggles strikethrough on/off for the selection or at the insertion point.
fontname Changes the font name for the selection or at the insertion point. This requires a font name string (like "Arial") as a value argument.
fontsize Changes the font size for the selection or at the insertion point. This requires an integer as a value argument.
forecolor Changes a font color for the selection or at the insertion point. This requires a hexadecimal color value string as a value argument.
backcolor Changes the document background color. It affects the background color of the containing block instead. This requires a color value string to be passed in as a value argument.
superscript Toggles superscript on/off for the selection or at the insertion point.
subscript Toggles subscript on/off for the selection or at the insertion point.
removeformat Removes all formatting from the current selection.
justifyleft Justifies the selection or insertion point to the left.
justifycenter Centers the selection or insertion point.
justifyright Right-justifies the selection or the insertion point.
justifyfull Justifies the selection or insertion point.
indent Indents the line containing the selection or insertion point.
outdent Outdents the line containing the selection or insertion point.
insertblockquote Creates a blockquote for the selection or at the insertion point.
insertorderedlist Creates a numbered ordered list for the selection or at the insertion point.
insertunorderedlist Creates a bulleted unordered list for the selection or at the insertion point.
inserthorizontalrule Inserts a <hr/> element at the insertion point, or replaces the selection with it.
insertdate Inserts the current date and time at the insertion point.
code Switchs to Source Code Mode to edit the HTML Directly.
fullscreenenter Makes the Rich Text Editor enter full-screen mode.
fullscreenexit Makes the Rich Text Editor exit full-screen mode.
selectall Selects all of the content of the editable region.
newdoc Creates a new document.
save Saves the active content in the editor's content area.
undo Undoes the last executed command.
redo Redoes the previous undo command.
insertlink Adds a link to the selection.
insertchars Inserts a special character from a predefined list.
inserttable Inserts a table into your document.
insertimage Inserts an image at the selected position in the editor and allows you to set it's properties.
insertvideo Inserts a video at the selected position.
insertcode Allows you to easily post syntax highlighted code.
html2pdf Saves the active content in the editor's content area to a PDF file.
print Prints the current page.
preview Peviews the current page.
find Finds and allows replacements of text in the editor's content area.