Function: getPeerDependencyFromEditor()
getPeerDependencyFromEditor<
Plan
>(editor
,planName
):LexicalPlanDependency
<Plan
> |undefined
Get the finalized config and output of a Plan that was used to build the editor by name.
This can be used from the implementation of a LexicalNode or in other situation where you have an editor reference but it's not easy to pass the config around. Use this version if you do not have a concrete reference to the Plan for some reason (e.g. it is an optional peer dependency, or you are avoiding a circular import).
Both the explicit Plan type and the name are required.
Type Parameters
• Plan extends AnyLexicalPlan
= never
Parameters
• editor: LexicalEditor
The editor that may have been built using plan
• planName: Plan
["name"
]
The name of the Plan
Returns
LexicalPlanDependency
<Plan
> | undefined
The config and output of the Plan or undefined
Example
import type { EmojiPlan } from "@etrepum/lexical-emoji-plan";
getPeerDependencyFromEditor<typeof EmojiPlan>(editor, "@etrepum/lexical-emoji-plan/Emoji");