Skip to main content

EditorState

class
class EditorState

Import

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

Members10

_flushSync
boolean
_nodeMap
NodeMap
_parsed
boolean

True if this EditorState was parsed without running transforms

_readOnly
boolean
_selection
null | BaseSelection
_slotsUsed
boolean

True if this EditorState or the LexicalEditor that created it has ever used slots

clone()
(selection?: null | BaseSelection) => EditorState
isEmpty()
() => boolean
read()
<V>(callbackFn: () => V, options?: EditorStateReadOptions) => V
toJSON()
(compact?: false) => SerializedEditorState | (compact: boolean) => CompactSerializedEditorState

This document's JSON, in the legacy form that writes every property. The form is this call's to state, never inherited: called with no argument — including by `JSON.stringify`, for which this is the `toJSON` hook — it writes the legacy form whatever $withCompactExport encloses it. That is what makes this signature true, and it is the behavior that predates the compact form. A nested editor still follows the document containing it, because LexicalEditor.toJSON passes the enclosing form on explicitly rather than leaving it to be picked up here.