pub struct LexicalExtension<Config: ExtensionConfigBase = (), Output: 'static = (), Init: 'static = ()> {Show 18 fields
pub name: String,
pub conflicts_with: Vec<String>,
pub dependencies: Vec<AnyLexicalExtensionArgument>,
pub peer_dependencies: Vec<NormalizedPeerDependency>,
pub config: Config,
pub merge_config: Option<ExtensionMergeConfigFn<Config>>,
pub nodes: Vec<NodeClass>,
pub namespace: Option<String>,
pub editable: Option<bool>,
pub on_warn: Option<Rc<dyn Fn(LexicalError, &Editor) -> Result<(), LexicalError>>>,
pub initial_editor_state: Option<InitialEditorStateType>,
pub theme: Option<Object>,
pub parent_editor: Option<Editor>,
pub html: HtmlConfig,
pub init: Option<ExtensionInitFn<Config, Init>>,
pub build: Option<ExtensionBuildFn<Config, Output, Init>>,
pub register: Option<ExtensionRegisterFn<Config, Output, Init>>,
pub after_registration: Option<ExtensionRegisterFn<Config, Output, Init>>,
}Expand description
LexicalExtension: a composable, named unit of editor configuration
(nodes, the initial state) and of behavior registered once the editor
exists. Write one with struct update syntax over
LexicalExtension::new, and make it with
define_extension.
An extension without build has no output, and one without init no
init result (JS’s undefined).
Fields§
§name: Stringname: unique in an editor.
conflicts_with: Vec<String>conflictsWith: names of extensions this one can’t be built with.
dependencies: Vec<AnyLexicalExtensionArgument>dependencies: other extensions, optionally with config overrides.
peer_dependencies: Vec<NormalizedPeerDependency>peerDependencies: extensions, by name, this one configures or
reads when another extension brings them.
config: Configconfig: the default config.
merge_config: Option<ExtensionMergeConfigFn<Config>>mergeConfig; without it, ExtensionConfigBase::shallow_merge.
nodes: Vec<NodeClass>nodes: node classes, and node replacements as NodeClasses
(LexicalNodeReplacement).
namespace: Option<String>namespace: the editor’s namespace; the last extension that sets it
wins.
editable: Option<bool>editable: whether the editor starts editable; the last extension
that sets it wins.
on_warn: Option<Rc<dyn Fn(LexicalError, &Editor) -> Result<(), LexicalError>>>onWarn: the last extension that sets it wins.
initial_editor_state: Option<InitialEditorStateType>$initialEditorState.
theme: Option<Object>theme, merged into the themes of the extensions before it.
parent_editor: Option<Editor>parentEditor: the editor to nest the new one in.
html: HtmlConfightml: exportDOM overrides by node type and import conversions.
init: Option<ExtensionInitFn<Config, Init>>§build: Option<ExtensionBuildFn<Config, Output, Init>>§register: Option<ExtensionRegisterFn<Config, Output, Init>>§after_registration: Option<ExtensionRegisterFn<Config, Output, Init>>