DHTMLX Docs & Samples Explorer

API Functions

Most of the functions do not have any incoming arguments and work with selected text.

The following functions are responsible for applying the bold, italic, underlined or stroked through styles to the selected text:

  applyBold();
  applyItalic();
  applyUnderscore();
  applyStrikethrough();

Use these two methods to superscript or subscript the selected text:

  applySub();
  applySuper();

Formatting, that is applied by methods mentioned above, can be removed using following method:

  clearFormatting();

To set selected text alignment, the following functions are used:

  alignLeft();
  alignRight();
  alignCenter();
  alignJustify();

The lists can be created and the text indent can be increased or decreased like this:

  createNumList();
  createBulList();
  increaseIndent();
  decreaseIndent();

The following methods are used with the selected text block to set the heading:

  applyH1();
  applyH2();
  applyH3();
  applyH4();

There is the method that gets html content of the editor document:

  getContent();

The following method sets the content to the editor document, passing the parameter htmlString - a html string that should be set as the editor content:

  setContent(htmlString)

There is also the possibility to set the content from an html document to the editor document, passing the parameter url - the path to the html page:

  setContentHTML(url);