Skip to main content
cut

RichEditCommands.insertHtml Property

Gets a command to add an HTML formatted content in place of a selected range.

Declaration

readonly insertHtml: InsertHtmlCommand

Property Value

Type Description
InsertHtmlCommand

An object that provides methods that execute the command and check its state.

Remarks

Call the execute(html) method to invoke the command. The method checks the command state (obtained via the getState method) to determine whether the action can be performed.

richEdit.commands.insertHtml.execute("<b>SomeBoldText</b>")
richEdit.commands.insertHtml.execute("<table border='2'><tr><td>Text</td></tr></table>")

Refer to the following section for more information: Client Commands.

Supported tags

The following table lists which HTML tags are supported by the insertHtml command.

Tag Attribute Interpretation
A href Specifies the URL of the page a hyperlink goes to
title Specifies the title of a hyperlink which appears to users as a tooltip
B Bold text
Br Line feed
Div A separate section of the document that groups elements
I Italic text
Img src Location of inline image (URI)
height Image height
width Image width
Li Defines the list item
Ol Defines an ordered list
P Defines a paragraph
Span Combined with the style sheet, specifies formatting of the text within the tag
Table Defines a table
Table bgcolor Specifies shading
Table border Specifies border width
Table borderSpacing Specifies border spacing
Table marginLeft Specifies the table’s left margin
Table width Specifies table width
TD Defines a table cell
TD bgcolor Specifies shading
TD border Specifies border width
TD colspan Specifies the number of columns a cell should span
TD rowspan Specifies the number of rows a cell should span
TD valign Specifies vertical alignment for cell contents
TD width Specifies the width of a cell
TH Defines a table cell with bold text and center aligned contents
TH (any allowed) The same as for the <TD> tag
TR Defines a row in a table
TT Teletype text
Ul Defines bulleted list

The fontStyle, textTransform, textDecoration, color, backgroundColor, fontFamily, fontSize, display, and verticalAlign attributes are interpreted for all supported tags.

Note that the command does not support the style tag and CSS attributes.

See Also