Skip to main content

InitialEditorConfig

interface
interface InitialEditorConfig

Import

import { InitialEditorConfig } from '@modular/sdk/editor';

Members9

$initialEditorStateoptional
InitialEditorStateType

The initial EditorState as a JSON string, an EditorState, or a function to update the editor (once).

editableoptional
CreateEditorArgs['editable']

Whether the initial state of the editor is editable or not

htmloptional
CreateEditorArgs['html']

Overrides for HTML serialization (exportDOM) and deserialization (importDOM) that does not require subclassing and node replacement

namespaceoptional
CreateEditorArgs['namespace']

The namespace of this Editor. If two editors share the same namespace, JSON will be the clipboard interchange format. Otherwise HTML will be used.

nodesoptional
CreateEditorArgs['nodes'] | (() => CreateEditorArgs['nodes'])

The nodes that this Extension adds to the Editor configuration, will be merged with other Extensions. Can be a function to defer the access of the nodes to editor construction which may be useful in cases when the node and extension are defined in different modules and have depenendencies on each other, depending on the bundler configuration.

onErroroptional
(error: Error, editor: LexicalEditor) => void

The editor will catch errors that happen during updates and reconciliation and call this. It defaults to `(error) => { throw error }`.

onWarnoptional
(error: Error, editor: LexicalEditor) => void

Optional handler for recoverable, warn-level conditions (e.g. the update-recursion guard tripping) that the editor has already recovered from. Mirrors onError but at warn severity, so embedders can route the condition to telemetry without raising an error alarm. Defaults to a handler that throws in development and only `console.warn`s in production.

parentEditoroptional
CreateEditorArgs['parentEditor']

Used when this editor is nested inside of another editor

themeoptional
CreateEditorArgs['theme']

EditorThemeClasses that will be deep merged with other Extensions