RichTextEditor Demo
Home Pricing

## Read-Only Mode

Rich Text Editor can be configured via readOnly property thats defines whether RichTextEditor should be an active HTML editor, or a read-only document viewer.

Hello world!

### Demo Code:

    import { createRichTextEditor } from "ts-rich-text-editor";

    const editor = await createRichTextEditor("#div_editor1", {}, {
      basePath: "/richtexteditor",
    });

    // Toggle read-only mode
    editor.setReadOnly(true);
    editor.setReadOnly(false);

    <p>
    	<button class="btn btn-primary btn-wide transition-3d-hover mb-4 mb-sm-0 mr-3" onclick="toggle_readOnly()">Toggle ReadOnly</button>
    </p>

    <link rel="stylesheet" href="/richtexteditor/rte_theme_default.css" />
    <script type="text/javascript" src="/richtexteditor/rte.js"></script>
    <script type="text/javascript" src='/richtexteditor/plugins/all_plugins.js'></script>

    <div id="div_editor1">
    	<p>Hello world!</p>
    	<p><img src='/images/editor-image.png' /></p>
    </div>

    <script>
    	var editor1 = new RichTextEditor("#div_editor1");

    	function toggle_readOnly() {
    		if (editor1.getReadOnly())
    			editor1.setReadOnly(false);
    		else
    			editor1.setReadOnly(true);
    	}

    </script>

### Relative Links

- Use JavaScript API
- getReadOnly
- setReadOnly
- all-configs