add onSelectionUpdate callback to edra editor

This commit is contained in:
Justin Edmund 2025-12-21 15:47:34 -08:00
parent 0339a3f832
commit 180c26a244
2 changed files with 4 additions and 1 deletions

View file

@ -43,6 +43,7 @@
editable = true,
content,
onUpdate,
onSelectionUpdate,
autofocus = false,
class: className
}: EdraEditorProps = $props();
@ -70,7 +71,8 @@
slashcommand(SlashCommandList)
],
{
onUpdate,
...(onUpdate && { onUpdate }),
...(onSelectionUpdate && { onSelectionUpdate }),
onTransaction(props) {
// Only update if editor instance actually changed
// The old pattern (editor = undefined; editor = props.editor) was a Svelte 4

View file

@ -9,6 +9,7 @@ export interface EdraEditorProps {
editor?: Editor;
autofocus?: boolean;
onUpdate?: () => void;
onSelectionUpdate?: () => void;
class?: string;
}