Editing states

readonly#

Type: boolean

Default: false

Starts the editor in read-only mode. Content stays visible and selectable, but cannot be edited. Toolbar and pathbar are locked, and nested contenteditable regions are disabled as well.

On a <textarea> host, the initial value also comes from the element’s readOnly attribute.

Toggle at runtime with app.setEditorReadonly(true | false).

const app = Redactor('#entry', {
  readonly: true
});

disabled#

Type: boolean

Default: false

Starts the editor in disabled mode. The UI is visible but not interactive: editing is blocked, toolbar controls are disabled, and a non-interactive overlay covers the editor area.

On a <textarea> host, the initial value also comes from the element’s disabled attribute.

Toggle at runtime with app.setEditorDisabled(true | false).

const app = Redactor('#entry', {
  disabled: true
});

placeholder#

Type: false | string

Default: false

Placeholder text shown when the editor is empty. Redactor sets data-placeholder on the editable root and toggles the rx-has-placeholder class while content is empty.

If the option is false, Redactor falls back to the host element’s data-placeholder or placeholder attribute.

const app = Redactor('#entry', {
  placeholder: 'Start writing…'
});

Individual editable blocks can have their own placeholder. Set data-placeholder on the block element (or pass placeholder in block data when creating/loading JSON). Redactor toggles rx-block-has-placeholder on the block while it is empty.

<p data-placeholder="Write a summary…"></p>;

Or when inserting a block via API:

app.block.insert({
  type: 'text',
  data: { placeholder: 'Write a summary…' }
});

clickToEdit#

Type: boolean

Default: false

Defers full editor initialization until the user clicks the host element. Before activation, the host gets the rx-click-to-edit class; after the first click, Redactor loads content and starts modules as usual.

Works only when the host element is a <div>. On a <textarea> host, clickToEdit is ignored and the editor starts immediately.

Useful when the editor should stay lightweight until the user explicitly starts editing.

const app = Redactor('#entry', {
  clickToEdit: true
});

breakline#

Type: boolean

Default: false

Enables breakline mode. Incoming HTML is paragraphized into a line-based structure (<div> blocks with <br> separators) instead of the default block tag from markup (usually <p>). The editable root receives the rx-editor-breakline class.

Typical use cases: single-field captions, chat-style input, or any layout where line breaks matter more than paragraph blocks.

const app = Redactor('#entry', {
  breakline: true
});