Skip to main content

Other Options

These options cover iframe settings, undo history, form integration, spellcheck, content editability controls, and various other editor behaviors.

Iframe

OptionTypeDefaultDescription
iframe_attrsobject{}Additional HTML attributes applied to the editor iframe element.
doctypestring'<!DOCTYPE html>'Doctype declaration used inside the editor iframe document.
content_security_policystring''Content Security Policy applied to the editor iframe via a <meta> tag.
iframe_aria_textstring'Rich Text Area. Press ALT-0 for help.'ARIA label text for the editor iframe, read by screen readers.

UI

OptionTypeDefaultDescription
custom_ui_selectorstring''CSS selector matching elements that are part of the editor UI. Prevents the editor from treating clicks on these elements as a blur event.
draggable_modalbooleanfalseAllow dialog windows to be dragged by their title bar.
sidebar_showstringName of a sidebar panel to open automatically when the editor initializes.
help_accessibilitybooleantrueShow a keyboard shortcut hint for opening the help dialog.

Undo and history

OptionTypeDefaultDescription
custom_undo_redo_levelsnumber0 (unlimited)Maximum number of undo levels to keep. Set to 0 for unlimited history.

Events

OptionTypeDefaultDescription
disable_nodechangebooleanfalseDisable the NodeChange event that fires when the cursor moves to a different node. Can improve performance in very large documents.

Form integration

OptionTypeDefaultDescription
hidden_inputbooleantrueCreate a hidden input element that mirrors the editor content, enabling standard form submission.
submit_patchbooleantruePatch the parent form's submit method to save editor content to the hidden input before submission.
add_form_submit_triggerbooleantrueAutomatically save editor content when the parent form is submitted.
add_unload_triggerbooleantrueSave editor content to the hidden input before the page unloads.

Spellcheck and input

OptionTypeDefaultDescription
browser_spellcheckbooleanfalseEnable the browser's built-in spellcheck on the editor content.

Object and image resizing

OptionTypeDefaultDescription
object_resizingboolean/stringtrueEnable resize handles on images and other objects. Pass a CSS selector string to restrict which elements are resizable.
resize_img_proportionalbooleantrueMaintain aspect ratio when resizing images with drag handles.

Inline boundaries

OptionTypeDefaultDescription
inline_boundariesbooleantrueShow visual caret indicators at the edges of inline elements like links, allowing the user to type before or after them.
inline_boundaries_selectorstring'a[href],code,span.editor42-m-annotation'CSS selector for inline elements that display boundary indicators.

Directionality

OptionTypeDefaultDescription
directionalitystringText direction for the editor content. Typically 'ltr' or 'rtl'. Auto-detected from the editor's language setting when omitted.

Non-editable content

OptionTypeDefaultDescription
noneditable_classstring'editor42NonEditable'CSS class that marks an element as non-editable within the editor.
editable_classstring'editor42Editable'CSS class that marks an element as editable inside a non-editable parent.
noneditable_regexpRegExp/RegExp[][]Regular expression patterns matching content that should be rendered as non-editable.

Accordion defaults

OptionTypeDefaultDescription
details_initial_statestring'inherited'Initial open/closed state of accordion (<details>) elements when inserted.
details_serialized_statestring'inherited'Open/closed state of accordion elements in the serialized (saved) output.

Content initialization

OptionTypeDefaultDescription
init_content_syncbooleanfalseInitialize content synchronously instead of asynchronously. May block the main thread for large documents.

Color output

OptionTypeDefaultDescription
force_hex_colorstring'off'Force color values to hex format. 'always' converts all colors, 'rgb_only' converts only RGB values, 'off' leaves colors as-is.

Anchors

OptionTypeDefaultDescription
anchor_topstring/false'#top'Anchor value used for "top of page" links. Set to false to remove from the anchor list.
anchor_bottomstring/false'#bottom'Anchor value used for "bottom of page" links. Set to false to remove from the anchor list.

Example

editor42.init({
selector: 'textarea',
browser_spellcheck: true,
custom_undo_redo_levels: 50,
draggable_modal: true,
directionality: 'ltr',
object_resizing: 'img',
resize_img_proportional: true,
iframe_attrs: { loading: 'lazy' },
content_security_policy: "default-src 'self'"
});