Skip to content

Commit

Permalink
bug: Numbered list does not increment in ImageNode caption
Browse files Browse the repository at this point in the history
  • Loading branch information
umaranis committed May 6, 2024
1 parent 44c2296 commit b38af24
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/svelte-lexical/src/lib/core/NestedComposer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Klass,
LexicalEditor,
LexicalNode,
KlassConstructor,
Transform,
} from 'lexical';
import {onMount, setContext} from 'svelte';
Expand All @@ -13,6 +15,15 @@
export let initialTheme: EditorThemeClasses | null = null;
export let initialNodes: ReadonlyArray<Klass<LexicalNode>> | null = null;
function getTransformSetFromKlass(
klass: KlassConstructor<typeof LexicalNode>,
): Set<Transform<LexicalNode>> {
const transform = klass.transform();
return transform !== null
? new Set<Transform<LexicalNode>>([transform])
: new Set<Transform<LexicalNode>>();
}
setContext('editor', initialEditor);
const composerTheme = initialTheme || parentEditor._config.theme;
Expand All @@ -30,7 +41,7 @@
klass: entry.klass,
replace: entry.replace,
replaceWithKlass: entry.replaceWithKlass,
transforms: new Set(),
transforms: getTransformSetFromKlass(entry.klass),
});
}
} else {
Expand Down

0 comments on commit b38af24

Please sign in to comment.