insertValue

inserts content at the current cursor position

void insertValue(string value, [string type] );
value
stringthe value to be set for the component type
stringoptional, the format of the inserted value. It can be: "html", "text", "markdown", "raw" (Richtext AST content)

Example

const md = "**Inserted** markdown content";
 
$$("editor").insertValue(md, "markdown");

Related samples

Details

If a selection exists, it is replaced. The value is interpreted according to the specified type.

If the type parameter isn't specified, the method treats the content according to the current datatype parameter ("html" by default).

Note that the markdown parser of Rich Text Editor doesn't provide support for nested structures (except bold inside italic). This means that combinations such as bold inside a link, italic inside a list, or multi-level lists will not render correctly while being pasted, added via the setValue() method or inserted via the insertValue() method with the "markdown" format or imported in an .md file.

See also
  • API
  • Articles
  • Back to top
    Join Our Forum
    We've retired comments here. Visit our forum for faster technical support, connect with other developers, and share your feedback there.