Skip to main content

Function: buildEditorFromPlans()

buildEditorFromPlans(...plans): LexicalEditorWithDispose

Build a LexicalEditor by combining together one or more plans, optionally overriding some of their configuration.

Parameters

• ...plans: AnyLexicalPlanArgument[]

Plan arguments (plans or plans with config overrides)

Returns

LexicalEditorWithDispose

An editor handle

Examples

const editor = buildEditorFromPlans(
definePlan({
name: "[root]",
dependencies: [
RichTextPlan,
configPlan(EmojiPlan, { emojiBaseUrl: "/assets/emoji" }),
],
register: (editor: LexicalEditor) => {
console.log("Editor Created");
return () => console.log("Editor Disposed");
},
}),
);
const editor = buildEditorFromPlans(
RichTextPlan,
configPlan(EmojiPlan, { emojiBaseUrl: "/assets/emoji" }),
);

Defined in

lexical-builder/src/LexicalBuilder.ts:72