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 {