diff --git a/src/lib/components/edra/headless/editor.svelte b/src/lib/components/edra/headless/editor.svelte index 5cc1eebb..f8eadfa8 100644 --- a/src/lib/components/edra/headless/editor.svelte +++ b/src/lib/components/edra/headless/editor.svelte @@ -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 diff --git a/src/lib/components/edra/types.ts b/src/lib/components/edra/types.ts index 46e64926..ece189fe 100644 --- a/src/lib/components/edra/types.ts +++ b/src/lib/components/edra/types.ts @@ -9,6 +9,7 @@ export interface EdraEditorProps { editor?: Editor; autofocus?: boolean; onUpdate?: () => void; + onSelectionUpdate?: () => void; class?: string; }