plugin.setTextContent

The 'setTextContent' function replaces the whole content with the given text in the HTML editor.

  • Prototype: plugin.setTextContent(iDbPos, sTxt, bRich, sSsgFn);
  • Parameters:
    1. iDbPos: a position number (0-based) of the database on the tab control; -1 for the current database.
    2. sTxt: the new HTML source or plain text.
    3. bRich: true for HTML source, false for plain text.
    4. sSsgFn: specifies path to a SSG file corresponding to the new text content; Defaults to current document if absent or empty. This parameter may be useful for displaying rendered content (e.g. markdown) in the text area without making confusion to the current document.
  • Return Value: true on success, or false on failure.
  • Example:
    plugin.setTextContent(-1, '<html><body>NEW CONTENT</body></html>', true, plugin.getCurDocPath()+'/newdoc.html');