From 299b6e0301273340090b551eb953c8655c3e4597 Mon Sep 17 00:00:00 2001 From: umaranis Date: Thu, 6 Jul 2023 22:01:21 +1000 Subject: [PATCH] refactor: Composer.getEditor() for easy access to editor --- .../src/components/richtext/RichTextComposer.svelte | 2 +- packages/svelte-lexical/src/core/Composer.svelte | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/svelte-lexical/src/components/richtext/RichTextComposer.svelte b/packages/svelte-lexical/src/components/richtext/RichTextComposer.svelte index 3cb4d39..1fe07d9 100644 --- a/packages/svelte-lexical/src/components/richtext/RichTextComposer.svelte +++ b/packages/svelte-lexical/src/components/richtext/RichTextComposer.svelte @@ -41,7 +41,7 @@ }; export function getEditor(): LexicalEditor { - return composer.$$.context.get('editor'); + return composer.getEditor(); } diff --git a/packages/svelte-lexical/src/core/Composer.svelte b/packages/svelte-lexical/src/core/Composer.svelte index 8754c68..dd280e7 100644 --- a/packages/svelte-lexical/src/core/Composer.svelte +++ b/packages/svelte-lexical/src/core/Composer.svelte @@ -72,6 +72,10 @@ const isEditable = initialConfig.editable; editor.setEditable(isEditable !== undefined ? isEditable : true); }); + + export function getEditor() { + return editor; + }