diff --git a/packages/svelte-lexical/src/core/plugins/link/FloatingLinkEditor.svelte b/packages/svelte-lexical/src/core/plugins/link/FloatingLinkEditor.svelte index b73754b..a3914a0 100644 --- a/packages/svelte-lexical/src/core/plugins/link/FloatingLinkEditor.svelte +++ b/packages/svelte-lexical/src/core/plugins/link/FloatingLinkEditor.svelte @@ -29,11 +29,11 @@ let inputRef: HTMLInputElement; let linkUrl = ''; let editedLinkUrl = ''; - let isEditMode = false; + export let isEditMode: Writable; let lastSelection: RangeSelection | GridSelection | NodeSelection | null = null; - $: if (isEditMode && inputRef) { + $: if ($isEditMode && inputRef) { inputRef.focus(); } @@ -107,7 +107,7 @@ linkUrl = ''; } } - if (isEditMode) { + if ($isEditMode) { editedLinkUrl = linkUrl; } const editorElem = editorRef; @@ -139,7 +139,7 @@ setFloatingElemPositionForLinkEditor(null, editorElem, anchorElem); } lastSelection = null; - isEditMode = false; + $isEditMode = false; linkUrl = ''; } @@ -154,7 +154,7 @@ handleLinkSubmission(); } else if (event.key === 'Escape') { event.preventDefault(); - isEditMode = false; + $isEditMode = false; } } @@ -163,7 +163,7 @@ if (linkUrl !== '') { editor.dispatchCommand(TOGGLE_LINK_COMMAND, sanitizeUrl(editedLinkUrl)); } - isEditMode = false; + $isEditMode = false; } } @@ -172,7 +172,7 @@