Module: lexical
Classes
- ArtificialNode__DO_NOT_USE
- DecoratorNode
- EXPERIMENTAL_DecoratorElementNode
- EXPERIMENTAL_NestedRootNode
- EditorState
- ElementNode
- LexicalEditor
- LexicalNode
- LineBreakNode
- NodeSelection
- ParagraphNode
- Point
- RangeSelection
- RootNode
- TabNode
- TextNode
Interfaces
Type Aliases
CommandListener
Ƭ CommandListener<P
>: (payload
: P
, editor
: LexicalEditor
) => boolean
Type parameters
Name |
---|
P |
Type declaration
▸ (payload
, editor
): boolean
Parameters
Name | Type |
---|---|
payload | P |
editor | LexicalEditor |
Returns
boolean
Defined in
packages/lexical/src/LexicalEditor.ts:252
CommandListenerPriority
Ƭ CommandListenerPriority: 0
| 1
| 2
| 3
| 4
Defined in
packages/lexical/src/LexicalEditor.ts:256
CommandPayloadType
Ƭ CommandPayloadType<TCommand
>: TCommand
extends LexicalCommand
<infer TPayload> ? TPayload
: never
Type helper for extracting the payload type from a command.
Example
const MY_COMMAND = createCommand<SomeType>();
// ...
editor.registerCommand(MY_COMMAND, payload => {
// Type of `payload` is inferred here. But lets say we want to extract a function to delegate to
handleMyCommand(editor, payload);
return true;
});
function handleMyCommand(editor: LexicalEditor, payload: CommandPayloadType<typeof MY_COMMAND>) {
// `payload` is of type `SomeType`, extracted from the command.
}
Type parameters
Name | Type |
---|---|
TCommand | extends LexicalCommand <unknown > |
Defined in
packages/lexical/src/LexicalEditor.ts:289
CreateEditorArgs
Ƭ CreateEditorArgs: Object
Type declaration
Name | Type |
---|---|
disableEvents? | boolean |
editable? | boolean |
editorState? | EditorState |
html? | HTMLConfig |
namespace? | string |
nodes? | ReadonlyArray <Klass <LexicalNode > | LexicalNodeReplacement > |
onError? | ErrorHandler |
parentEditor? | LexicalEditor |
theme? | EditorThemeClasses |
Defined in
packages/lexical/src/LexicalEditor.ts:188
DOMChildConversion
Ƭ DOMChildConversion: (lexicalNode
: LexicalNode
, parentLexicalNode
: LexicalNode
| null
| undefined
) => LexicalNode
| null
| undefined
Type declaration
▸ (lexicalNode
, parentLexicalNode
): LexicalNode
| null
| undefined
Parameters
Name | Type |
---|---|
lexicalNode | LexicalNode |
parentLexicalNode | LexicalNode | null | undefined |
Returns
LexicalNode
| null
| undefined
Defined in
packages/lexical/src/LexicalNode.ts:132
DOMConversion
Ƭ DOMConversion<T
>: Object
Type parameters
Name | Type |
---|---|
T | extends HTMLElement = HTMLElement |
Type declaration
Name | Type |
---|---|
conversion | DOMConversionFn <T > |
priority? | 0 | 1 | 2 | 3 | 4 |
Defined in
packages/lexical/src/LexicalNode.ts:123
DOMConversionFn
Ƭ DOMConversionFn<T
>: (element
: T
) => DOMConversionOutput
| null
Type parameters
Name | Type |
---|---|
T | extends HTMLElement = HTMLElement |
Type declaration
▸ (element
): DOMConversionOutput
| null
Parameters
Name | Type |
---|---|
element | T |
Returns
DOMConversionOutput
| null
Defined in
packages/lexical/src/LexicalNode.ts:128
DOMConversionMap
Ƭ DOMConversionMap<T
>: Record
<NodeName
, (node
: T
) => DOMConversion
<T
> | null
>
Type parameters
Name | Type |
---|---|
T | extends HTMLElement = HTMLElement |
Defined in
packages/lexical/src/LexicalNode.ts:137
DOMConversionOutput
Ƭ DOMConversionOutput: Object
Type declaration
Name | Type |
---|---|
after? | (childLexicalNodes : LexicalNode []) => LexicalNode [] |
forChild? | DOMChildConversion |
node | null | LexicalNode | LexicalNode [] |
Defined in
packages/lexical/src/LexicalNode.ts:143
DOMExportOutput
Ƭ DOMExportOutput: Object
Type declaration
Name | Type |
---|---|
after? | (generatedElement : HTMLElement | Text | null | undefined ) => HTMLElement | Text | null | undefined |
element | HTMLElement | Text | null |
Defined in
packages/lexical/src/LexicalNode.ts:149
EditableListener
Ƭ EditableListener: (editable
: boolean
) => void
Type declaration
▸ (editable
): void
Parameters
Name | Type |
---|---|
editable | boolean |
Returns
void
Defined in
packages/lexical/src/LexicalEditor.ts:254
EditorConfig
Ƭ EditorConfig: Object
Type declaration
Name | Type |
---|---|
disableEvents? | boolean |
namespace | string |
theme | EditorThemeClasses |
Defined in
packages/lexical/src/LexicalEditor.ts:165
EditorSetOptions
Ƭ EditorSetOptions: Object
Type declaration
Name | Type |
---|---|
tag? | string |
Defined in
packages/lexical/src/LexicalEditor.ts:95
EditorThemeClassName
Ƭ EditorThemeClassName: string
Defined in
packages/lexical/src/LexicalEditor.ts:72
EditorThemeClasses
Ƭ EditorThemeClasses: Object
Index signature
▪ [key: string
]: any
Type declaration
Defined in
packages/lexical/src/LexicalEditor.ts:103
ElementFormatType
Ƭ ElementFormatType: "left"
| "start"
| "center"
| "right"
| "end"
| "justify"
| ""
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:51
ElementPoint
Ƭ ElementPoint: Object
Type declaration
Name | Type |
---|---|
_selection | BaseSelection |
getNode | () => ElementNode |
is | (point : PointType ) => boolean |
isBefore | (point : PointType ) => boolean |
key | NodeKey |
offset | number |
set | (key : NodeKey , offset : number , type : "text" | "element" ) => void |
type | "element" |
Defined in
packages/lexical/src/LexicalSelection.ts:78
EventHandler
Ƭ EventHandler: (event
: Event
, editor
: LexicalEditor
) => void
Type declaration
▸ (event
, editor
): void
Parameters
Name | Type |
---|---|
event | Event |
editor | LexicalEditor |
Returns
void
Defined in
packages/lexical/src/LexicalEvents.ts:1197
HTMLConfig
Ƭ HTMLConfig: Object
Type declaration
Name | Type |
---|---|
export? | Map <Klass <LexicalNode >, (editor : LexicalEditor , target : LexicalNode ) => DOMExportOutput > |
import? | DOMConversionMap |
Defined in
packages/lexical/src/LexicalEditor.ts:180
Klass
Ƭ Klass<T
>: InstanceType
<T
["constructor"
]> extends T
? T
["constructor"
] : GenericConstructor
<T
> & T
["constructor"
]
Type parameters
Name | Type |
---|---|
T | extends LexicalNode |
Defined in
packages/lexical/src/LexicalEditor.ts:66
KlassConstructor
Ƭ KlassConstructor<Cls
>: GenericConstructor
<InstanceType
<Cls
>> & { [k in keyof Cls]: Cls[k] }
Type parameters
Name | Type |
---|---|
Cls | extends GenericConstructor <any > |
Defined in
packages/lexical/src/LexicalEditor.ts:61
LexicalCommand
Ƭ LexicalCommand<TPayload
>: Object
Type parameters
Name |
---|
TPayload |
Type declaration
Name | Type |
---|---|
type? | string |
Defined in
packages/lexical/src/LexicalEditor.ts:265
LexicalNodeReplacement
Ƭ LexicalNodeReplacement: Object
Type declaration
Name | Type |
---|---|
replace | Klass <LexicalNode > |
with | <T>(node : InstanceType <T >) => LexicalNode |
withKlass? | Klass <LexicalNode > |
Defined in
packages/lexical/src/LexicalEditor.ts:171
MutationListener
Ƭ MutationListener: (nodes
: Map
<NodeKey
, NodeMutation
>, payload
: { dirtyLeaves
: Set
<string
> ; prevEditorState
: EditorState
; updateTags
: Set
<string
> }) => void
Type declaration
▸ (nodes
, payload
): void
Parameters
Name | Type |
---|---|
nodes | Map <NodeKey , NodeMutation > |
payload | Object |
payload.dirtyLeaves | Set <string > |
payload.prevEditorState | EditorState |
payload.updateTags | Set <string > |
Returns
void
Defined in
packages/lexical/src/LexicalEditor.ts:243
NodeKey
Ƭ NodeKey: string
Defined in
packages/lexical/src/LexicalNode.ts:156
NodeMap
Ƭ NodeMap: Map
<NodeKey
, LexicalNode
>
Defined in
packages/lexical/src/LexicalNode.ts:50
NodeMutation
Ƭ NodeMutation: "created"
| "updated"
| "destroyed"
Defined in
packages/lexical/src/LexicalEditor.ts:221
PasteCommandType
Ƭ PasteCommandType: ClipboardEvent
| InputEvent
| KeyboardEvent
Defined in
packages/lexical/src/LexicalCommands.ts:17
PointType
Ƭ PointType: TextPoint
| ElementPoint
Defined in
packages/lexical/src/LexicalSelection.ts:89
SerializedEditor
Ƭ SerializedEditor: Object
Type declaration
Name | Type |
---|---|
editorState | SerializedEditorState |
Defined in
packages/lexical/src/LexicalEditor.ts:330
SerializedElementNode
Ƭ SerializedElementNode<T
>: Spread
<{ children
: T
[] ; direction
: "ltr"
| "rtl"
| null
; format
: ElementFormatType
; indent
: number
}, SerializedLexicalNode
>
Type parameters
Name | Type |
---|---|
T | extends SerializedLexicalNode = SerializedLexicalNode |
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:39
SerializedLexicalNode
Ƭ SerializedLexicalNode: Object
Type declaration
Name | Type |
---|---|
type | string |
version | number |
Defined in
packages/lexical/src/LexicalNode.ts:52
SerializedLineBreakNode
Ƭ SerializedLineBreakNode: SerializedLexicalNode
Defined in
packages/lexical/src/nodes/LexicalLineBreakNode.ts:21
SerializedParagraphNode
Ƭ SerializedParagraphNode: Spread
<{ textFormat
: number
}, SerializedElementNode
>
Defined in
packages/lexical/src/nodes/LexicalParagraphNode.ts:37
SerializedRootNode
Ƭ SerializedRootNode<T
>: SerializedElementNode
<T
>
Type parameters
Name | Type |
---|---|
T | extends SerializedLexicalNode = SerializedLexicalNode |
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:19
SerializedTabNode
Ƭ SerializedTabNode: SerializedTextNode
Defined in
packages/lexical/src/nodes/LexicalTabNode.ts:23
SerializedTextNode
Ƭ SerializedTextNode: Spread
<{ detail
: number
; format
: number
; mode
: TextModeType
; style
: string
; text
: string
}, SerializedLexicalNode
>
Defined in
packages/lexical/src/nodes/LexicalTextNode.ts:71
Spread
Ƭ Spread<T1
, T2
>: Omit
<T2
, keyof T1
> & T1
Type parameters
Name |
---|
T1 |
T2 |
Defined in
packages/lexical/src/LexicalEditor.ts:57
TextFormatType
Ƭ TextFormatType: "bold"
| "underline"
| "strikethrough"
| "italic"
| "highlight"
| "code"
| "subscript"
| "superscript"
Defined in
packages/lexical/src/nodes/LexicalTextNode.ts:84
TextModeType
Ƭ TextModeType: "normal"
| "token"
| "segmented"
Defined in
packages/lexical/src/nodes/LexicalTextNode.ts:94
TextPoint
Ƭ TextPoint: Object
Type declaration
Name | Type |
---|---|
_selection | BaseSelection |
getNode | () => TextNode |
is | (point : PointType ) => boolean |
isBefore | (point : PointType ) => boolean |
key | NodeKey |
offset | number |
set | (key : NodeKey , offset : number , type : "text" | "element" ) => void |
type | "text" |
Defined in
packages/lexical/src/LexicalSelection.ts:67
Transform
Ƭ Transform<T
>: (node
: T
) => void
Type parameters
Name | Type |
---|---|
T | extends LexicalNode |
Type declaration
▸ (node
): void
Parameters
Name | Type |
---|---|
node | T |
Returns
void
Defined in
packages/lexical/src/LexicalEditor.ts:213
Variables
BLUR_COMMAND
• Const
BLUR_COMMAND: LexicalCommand
<FocusEvent
>
Defined in
packages/lexical/src/LexicalCommands.ts:122
CAN_REDO_COMMAND
• Const
CAN_REDO_COMMAND: LexicalCommand
<boolean
>
Defined in
packages/lexical/src/LexicalCommands.ts:116
CAN_UNDO_COMMAND
• Const
CAN_UNDO_COMMAND: LexicalCommand
<boolean
>
Defined in
packages/lexical/src/LexicalCommands.ts:118
CLEAR_EDITOR_COMMAND
• Const
CLEAR_EDITOR_COMMAND: LexicalCommand
<void
>
Defined in
packages/lexical/src/LexicalCommands.ts:110
CLEAR_HISTORY_COMMAND
• Const
CLEAR_HISTORY_COMMAND: LexicalCommand
<void
>
Defined in
packages/lexical/src/LexicalCommands.ts:113
CLICK_COMMAND
• Const
CLICK_COMMAND: LexicalCommand
<MouseEvent
>
Defined in
packages/lexical/src/LexicalCommands.ts:30
COMMAND_PRIORITY_CRITICAL
• Const
COMMAND_PRIORITY_CRITICAL: 4
Defined in
packages/lexical/src/LexicalEditor.ts:262
COMMAND_PRIORITY_EDITOR
• Const
COMMAND_PRIORITY_EDITOR: 0
Defined in
packages/lexical/src/LexicalEditor.ts:258
COMMAND_PRIORITY_HIGH
• Const
COMMAND_PRIORITY_HIGH: 3
Defined in
packages/lexical/src/LexicalEditor.ts:261