Interface: LexicalPlan<Config, Name, Output, Init>
A Plan is a composable unit of LexicalEditor configuration (nodes, theme, etc) used to create an editor, plus runtime behavior that is registered after the editor is created.
A Plan may depend on other Plans, and provide functionality to other plans through its config.
Extends
InitialEditorConfig
.LexicalPlanInternal
<Config
,Output
,Init
>
Type Parameters
• Config extends PlanConfigBase
• Name extends string
• Output
• Init
Properties
$initialEditorState?
optional
$initialEditorState:InitialEditorStateType
The initial EditorState as a JSON string, an EditorState, or a function to update the editor (once).
Inherited from
InitialEditorConfig
.$initialEditorState
Defined in
lexical-builder-core/dist/types.d.ts:269
afterInitialization()?
optional
afterInitialization: (editor
,config
,state
) => () =>void
Parameters
• editor: LexicalEditor
The editor this Plan is being registered with
• config: Config
The merged configuration specific to this Plan
• state: PlanRegisterState
<Init
>
An object containing an AbortSignal that can be used, and methods for accessing the merged configuration of dependencies and peerDependencies
Returns
Function
A clean-up function
Returns
void
Defined in
lexical-builder-core/dist/types.d.ts:181
config?
optional
config:Config
The default configuration specific to this Plan. This Config may be seen by this Plan, or any Plan that uses it as a dependency.
The config may be mutated on register, this is particularly useful for vending functionality to other Plans that depend on this Plan.
Defined in
lexical-builder-core/dist/types.d.ts:118
conflictsWith?
optional
conflictsWith:string
[]
Plan names that must not be loaded with this Plan
Defined in
lexical-builder-core/dist/types.d.ts:103
dependencies?
optional
dependencies:AnyLexicalPlanArgument
[]
Other Plans that this Plan depends on, can also be used to configure them
Defined in
lexical-builder-core/dist/types.d.ts:105
editable?
optional
editable:boolean
Whether the initial state of the editor is editable or not
Inherited from
Defined in
lexical-builder-core/dist/types.d.ts:255
html?
optional
html:HTMLConfig
Overrides for HTML serialization (exportDOM) and deserialization (importDOM) that does not require subclassing and node replacement
Inherited from
Defined in
lexical-builder-core/dist/types.d.ts:251
init()?
optional
init: (editorConfig
,config
,state
) =>Init
Perform any necessary initialization before the editor is created, this runs after all configuration overrides for both the editor this this plan have been merged. May be used validate the editor configuration.
Parameters
• editorConfig: InitialEditorConfig
The in-progress editor configuration (mutable)
• config: Config
The merged configuration specific to this plan (mutable)
• state: PlanInitState
An object containing an AbortSignal that can be used, and methods for accessing the merged configuration of dependencies and peerDependencies
Returns
Init
Defined in
lexical-builder-core/dist/types.d.ts:155
mergeConfig()?
optional
mergeConfig: (config
,overrides
) =>Config
Parameters
• config: Config
The current configuration
• overrides: Partial
<Config
>
The partial configuration to merge
Returns
Config
The merged configuration
Defined in
lexical-builder-core/dist/types.d.ts:142
name
readonly
name:Name
The name of the Plan, must be unique
Defined in
lexical-builder-core/dist/types.d.ts:101
namespace?
optional
namespace:string
The namespace of this Editor. If two editors share the same namespace, JSON will be the clipboard interchange format. Otherwise HTML will be used.
Inherited from
Defined in
lexical-builder-core/dist/types.d.ts:237
nodes?
optional
nodes: readonly (KlassConstructor
<typeofLexicalNode
> |LexicalNodeReplacement
)[]
The nodes that this Plan adds to the Editor configuration, will be merged with other Plans
Inherited from
Defined in
lexical-builder-core/dist/types.d.ts:241
onError()?
optional
onError: (error
,editor
) =>void
The editor will catch errors that happen during updates and
reconciliation and call this. It defaults to
(error) => { throw error }
.
Parameters
• error: Error
The Error object
• editor: LexicalEditor
The editor that this error came from
Returns
void
Inherited from
Defined in
lexical-builder-core/dist/types.d.ts:264
parentEditor?
optional
parentEditor:LexicalEditor
Used when this editor is nested inside of another editor
Inherited from
InitialEditorConfig
.parentEditor
Defined in
lexical-builder-core/dist/types.d.ts:231
peerDependencies?
optional
peerDependencies:NormalizedPeerDependency
<AnyLexicalPlan
>[]
Other Plans, by name, that this Plan can optionally depend on or configure, if they are directly depended on by another Plan
Defined in
lexical-builder-core/dist/types.d.ts:110
register()?
optional
register: (editor
,config
,state
) =>RegisterCleanup
<Output
>
Parameters
• editor: LexicalEditor
The editor this Plan is being registered with
• config: Config
The merged configuration specific to this Plan
• state: PlanRegisterState
<Init
>
An object containing an AbortSignal that can be used, and methods for accessing the merged configuration of dependencies and peerDependencies
Returns
RegisterCleanup
<Output
>
A clean-up function
Defined in
lexical-builder-core/dist/types.d.ts:169
theme?
optional
theme:EditorThemeClasses
EditorThemeClasses that will be deep merged with other Plans
Inherited from
Defined in
lexical-builder-core/dist/types.d.ts:245