From b38af24b16a057d6f7092015937b2dd3e7a60d84 Mon Sep 17 00:00:00 2001 From: umaranis Date: Tue, 7 May 2024 08:17:09 +1000 Subject: [PATCH] bug: Numbered list does not increment in ImageNode caption --- .../src/lib/core/NestedComposer.svelte | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/svelte-lexical/src/lib/core/NestedComposer.svelte b/packages/svelte-lexical/src/lib/core/NestedComposer.svelte index 81487d5..9612d6c 100644 --- a/packages/svelte-lexical/src/lib/core/NestedComposer.svelte +++ b/packages/svelte-lexical/src/lib/core/NestedComposer.svelte @@ -4,6 +4,8 @@ Klass, LexicalEditor, LexicalNode, + KlassConstructor, + Transform, } from 'lexical'; import {onMount, setContext} from 'svelte'; @@ -13,6 +15,15 @@ export let initialTheme: EditorThemeClasses | null = null; export let initialNodes: ReadonlyArray> | null = null; + function getTransformSetFromKlass( + klass: KlassConstructor, + ): Set> { + const transform = klass.transform(); + return transform !== null + ? new Set>([transform]) + : new Set>(); + } + setContext('editor', initialEditor); const composerTheme = initialTheme || parentEditor._config.theme; @@ -30,7 +41,7 @@ klass: entry.klass, replace: entry.replace, replaceWithKlass: entry.replaceWithKlass, - transforms: new Set(), + transforms: getTransformSetFromKlass(entry.klass), }); } } else {