Search code examples
plaintexttinymce-5

How to initialize tinymce as plain-text editor


I want to use the tinymce editor for visualizing special chars like a paragraph like this: ¶ It should only visualize it. The value of the input should contain only plain text. Is there a setup param to force tinymce to work in plain text mode?


Solution

  • You can retrieve content from the TinyMCE editor as HTML or plaintext. To retrieve the content as plaintext specify format: 'text' when you get the content. For example:

    // Get the contents of the currently active editor as plain text
    tinymce.activeEditor.getContent({format: 'text'});
    

    For more information about getContent, see: https://www.tiny.cloud/docs/api/tinymce/tinymce.editor/#getcontent.