Skip to main content

@lexical/extension/getExtensionDependencyFromEditor

Functions

getExtensionDependencyFromEditor()

getExtensionDependencyFromEditor<Extension>(editor, extension): LexicalExtensionDependency<Extension>

Defined in: packages/lexical-extension/src/getExtensionDependencyFromEditor.ts:35

Get the finalized config and output of an Extension that was used to build the editor.

This is useful in the implementation of a LexicalNode or in other situations where you have an editor reference but it's not easy to pass the config or ExtensionRegisterState around.

It will throw if the Editor was not built using this Extension.

Inside an editor read/update, prefer $getExtensionDependency or $getExtensionOutput — they resolve the editor via $getEditor() so you don't have to thread it through.

Type Parameters

Extension

Extension extends AnyLexicalExtension

Parameters

editor

LexicalEditor

The editor that was built using extension

extension

Extension

The concrete reference to an Extension used to build this editor

Returns

LexicalExtensionDependency<Extension>

The config and output for that Extension