getTextContent

Gets the content written in Synap Editor as text.

Parameters:

<table> <thead> <tr><th>Name</th><th>Type</th><th>Attribute</th><th>Description</th></tr> </thead> <tbody> <tr> <td><code>options</code></td> <td>Object</td> <td>emoji</td> <td>
  • 'htmlcode': If there are emojis, converts them to HTML Character Code in &#x0000; format.
  • 'unicode': If there are emojis, converts them to Unicode in \u0000 format.
  • 'remove': If there are emojis, removes them from the text.
</td> </tr> </tbody> </table>

Return:

TypeDescription
StringThe text written in the editor.

Example:

var textContent = editor.getTextContent();
if (textContent.trim() !== '') {
    // Checks whether the editor's text content consists only of whitespace; only gets HTML when text content exists.
    html = editor.getPublishingHtml();
}

// emoji option
editor.getTextContent({
    emoji: 'htmlcode'
});