Class: LexicalEditor
lexical.LexicalEditor
Constructors
constructor
• new LexicalEditor(editorState
, parentEditor
, nodes
, config
, onError
, htmlConversions
, editable
)
Parameters
Name | Type |
---|---|
editorState | EditorState |
parentEditor | null | LexicalEditor |
nodes | RegisteredNodes |
config | EditorConfig |
onError | ErrorHandler |
htmlConversions | DOMConversionCache |
editable | boolean |
Defined in
lexical/src/LexicalEditor.ts:509
Properties
_blockCursorElement
• _blockCursorElement: null
| HTMLDivElement
Defined in
lexical/src/LexicalEditor.ts:507
_cloneNotNeeded
• _cloneNotNeeded: Set
<string
>
Defined in
lexical/src/LexicalEditor.ts:496
_commands
• _commands: Commands
Defined in
lexical/src/LexicalEditor.ts:490
_compositionKey
• _compositionKey: null
| string
Defined in
lexical/src/LexicalEditor.ts:484
_config
• _config: EditorConfig
Defined in
lexical/src/LexicalEditor.ts:494
_decorators
• _decorators: Record
<string
, unknown
>
Defined in
lexical/src/LexicalEditor.ts:492
_deferred
• _deferred: () => void
[]
Defined in
lexical/src/LexicalEditor.ts:485
_dirtyElements
• _dirtyElements: Map
<string
, boolean
>
Defined in
lexical/src/LexicalEditor.ts:498
_dirtyLeaves
• _dirtyLeaves: Set
<string
>
Defined in
lexical/src/LexicalEditor.ts:497
_dirtyType
• _dirtyType: 0
| 1
| 2
Defined in
lexical/src/LexicalEditor.ts:495
_editable
• _editable: boolean
Defined in
lexical/src/LexicalEditor.ts:506
_editorState
• _editorState: EditorState
Defined in
lexical/src/LexicalEditor.ts:482
_headless
• _headless: boolean
Defined in
lexical/src/LexicalEditor.ts:479
_htmlConversions
• _htmlConversions: DOMConversionCache
Defined in
lexical/src/LexicalEditor.ts:504
_key
• _key: string
Defined in
lexical/src/LexicalEditor.ts:502
_keyToDOMMap
• _keyToDOMMap: Map
<string
, HTMLElement
>
Defined in
lexical/src/LexicalEditor.ts:486
_listeners
• _listeners: Listeners
Defined in
lexical/src/LexicalEditor.ts:489
_nodes
• _nodes: RegisteredNodes
Defined in
lexical/src/LexicalEditor.ts:491
_normalizedNodes
• _normalizedNodes: Set
<string
>
Defined in
lexical/src/LexicalEditor.ts:499
_observer
• _observer: null
| MutationObserver
Defined in
lexical/src/LexicalEditor.ts:501
_onError
• _onError: ErrorHandler
Defined in
lexical/src/LexicalEditor.ts:503
_parentEditor
• _parentEditor: null
| LexicalEditor
Defined in
lexical/src/LexicalEditor.ts:480
_pendingDecorators
• _pendingDecorators: null
| Record
<string
, unknown
>
Defined in
lexical/src/LexicalEditor.ts:493
_pendingEditorState
• _pendingEditorState: null
| EditorState
Defined in
lexical/src/LexicalEditor.ts:483
_rootElement
• _rootElement: null
| HTMLElement
Defined in
lexical/src/LexicalEditor.ts:481
_updateTags
• _updateTags: Set
<string
>
Defined in
lexical/src/LexicalEditor.ts:500
_updates
• _updates: [() => void
, undefined
| EditorUpdateOptions
][]
Defined in
lexical/src/LexicalEditor.ts:487
_updating
• _updating: boolean
Defined in
lexical/src/LexicalEditor.ts:488
_window
• _window: null
| Window
Defined in
lexical/src/LexicalEditor.ts:505
Methods
blur
▸ blur(): void
Returns
void
Defined in
lexical/src/LexicalEditor.ts:907
dispatchCommand
▸ dispatchCommand<TCommand
>(type
, payload
): boolean
Type parameters
Name | Type |
---|---|
TCommand | extends LexicalCommand <unknown > |
Parameters
Name | Type |
---|---|
type | TCommand |
payload | CommandPayloadType <TCommand > |
Returns
boolean
Defined in
lexical/src/LexicalEditor.ts:743
focus
▸ focus(callbackFn?
, options?
): void
Parameters
Name | Type |
---|---|
callbackFn? | () => void |
options | EditorFocusOptions |
Returns
void
Defined in
lexical/src/LexicalEditor.ts:867
getDecorators
▸ getDecorators<T
>(): Record
<string
, T
>
Type parameters
Name |
---|
T |
Returns
Record
<string
, T
>
Defined in
lexical/src/LexicalEditor.ts:750
getEditorState
▸ getEditorState(): EditorState
Returns
Defined in
lexical/src/LexicalEditor.ts:815
getElementByKey
▸ getElementByKey(key
): null
| HTMLElement
Parameters
Name | Type |
---|---|
key | string |
Returns
null
| HTMLElement
Defined in
lexical/src/LexicalEditor.ts:811
getKey
▸ getKey(): string
Returns
string
Defined in
lexical/src/LexicalEditor.ts:758
getRootElement
▸ getRootElement(): null
| HTMLElement
Returns
null
| HTMLElement
Defined in
lexical/src/LexicalEditor.ts:754
hasNodes
▸ hasNodes<T
>(nodes
): boolean
Type parameters
Name | Type |
---|---|
T | extends Klass <LexicalNode > |
Parameters
Name | Type |
---|---|
nodes | T [] |
Returns
boolean
Defined in
lexical/src/LexicalEditor.ts:730
isComposing
▸ isComposing(): boolean
Returns
boolean
Defined in
lexical/src/LexicalEditor.ts:572
isEditable
▸ isEditable(): boolean
Returns
boolean
Defined in
lexical/src/LexicalEditor.ts:921
parseEditorState
▸ parseEditorState(maybeStringifiedEditorState
, updateFn?
): EditorState
Parameters
Name | Type |
---|---|
maybeStringifiedEditorState | string | SerializedEditorState <SerializedLexicalNode > |
updateFn? | () => void |
Returns
Defined in
lexical/src/LexicalEditor.ts:852
registerCommand
▸ registerCommand<P
>(command
, listener
, priority
): () => void
Type parameters
Name |
---|
P |
Parameters
Name | Type |
---|---|
command | LexicalCommand <P > |
listener | CommandListener <P > |
priority | CommandListenerPriority |
Returns
fn
▸ (): void
Returns
void
Defined in
lexical/src/LexicalEditor.ts:618
registerDecoratorListener
▸ registerDecoratorListener<T
>(listener
): () => void
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
listener | DecoratorListener <T > |
Returns
fn
▸ (): void
Returns
void
Defined in
lexical/src/LexicalEditor.ts:592
registerEditableListener
▸ registerEditableListener(listener
): () => void
Parameters
Name | Type |
---|---|
listener | EditableListener |
Returns
fn
▸ (): void
Returns
void
Defined in
lexical/src/LexicalEditor.ts:584
registerMutationListener
▸ registerMutationListener(klass
, listener
): () => void
Parameters
Name | Type |
---|---|
klass | Klass <LexicalNode > |
listener | MutationListener |
Returns
fn
▸ (): void
Returns
void
Defined in
lexical/src/LexicalEditor.ts:664
registerNodeTransform
▸ registerNodeTransform<T
>(klass
, listener
): () => void
Type parameters
Name | Type |
---|---|
T | extends LexicalNode <T > |
Parameters
Name | Type |
---|---|
klass | Klass <T > |
listener | Transform <T > |
Returns
fn
▸ (): void
Returns
void
Defined in
lexical/src/LexicalEditor.ts:706
registerNodeTransformToKlass
▸ Private
registerNodeTransformToKlass<T
>(klass
, listener
): RegisteredNode
Type parameters
Name | Type |
---|---|
T | extends LexicalNode <T > |
Parameters
Name | Type |
---|---|
klass | Klass <T > |
listener | Transform <T > |
Returns
RegisteredNode
Defined in
lexical/src/LexicalEditor.ts:685
registerRootListener
▸ registerRootListener(listener
): () => void
Parameters
Name | Type |
---|---|
listener | RootListener |
Returns
fn
▸ (): void
Returns
void
Defined in
lexical/src/LexicalEditor.ts:608
registerTextContentListener
▸ registerTextContentListener(listener
): () => void
Parameters
Name | Type |
---|---|
listener | TextContentListener |
Returns
fn
▸ (): void
Returns
void
Defined in
lexical/src/LexicalEditor.ts:600
registerUpdateListener
▸ registerUpdateListener(listener
): () => void
Parameters
Name | Type |
---|---|
listener | UpdateListener |
Returns
fn
▸ (): void
Returns
void
Defined in
lexical/src/LexicalEditor.ts:576
setEditable
▸ setEditable(editable
): void
Parameters
Name | Type |
---|---|
editable | boolean |
Returns
void
Defined in
lexical/src/LexicalEditor.ts:925
setEditorState
▸ setEditorState(editorState
, options?
): void
Parameters
Name | Type |
---|---|
editorState | EditorState |
options? | EditorSetOptions |
Returns
void
Defined in
lexical/src/LexicalEditor.ts:819
setRootElement
▸ setRootElement(nextRootElement
): void
Parameters
Name | Type |
---|---|
nextRootElement | null | HTMLElement |
Returns
void
Defined in
lexical/src/LexicalEditor.ts:762
toJSON
▸ toJSON(): SerializedEditor
Returns
Defined in
lexical/src/LexicalEditor.ts:932
update
▸ update(updateFn
, options?
): void
Parameters
Name | Type |
---|---|
updateFn | () => void |
options? | EditorUpdateOptions |
Returns
void
Defined in
lexical/src/LexicalEditor.ts:863