From 8f4cab6a1ae0fe61234cd0de751880f39dcf437f Mon Sep 17 00:00:00 2001 From: Cy Pokhrel Date: Tue, 15 Oct 2024 14:38:35 +0000 Subject: [PATCH] Fix editor loses focus when toggling list if list item empty (#3483) * fix editor loses focus when toggling list if list item empty * fix CONTRIBUTORS --- CONTRIBUTORS | 2 +- ts/editor/editor-toolbar/CommandIconButton.svelte | 1 + ts/editor/rich-text-input/RichTextInput.svelte | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b0002241c..a4b1aefb1 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -194,7 +194,7 @@ Gregory Abrasaldo Taylor Obyen <162023405+taylorobyen@users.noreply.github.com> Kris Cherven twwn -Shirish Pokhrel +Cy Pokhrel Park Hyunwoo Tomas Fabrizio Orsi diff --git a/ts/editor/editor-toolbar/CommandIconButton.svelte b/ts/editor/editor-toolbar/CommandIconButton.svelte index e81d8a793..83f4a9a93 100644 --- a/ts/editor/editor-toolbar/CommandIconButton.svelte +++ b/ts/editor/editor-toolbar/CommandIconButton.svelte @@ -27,6 +27,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html function action() { execCommand(key); + $focusedInput?.focus(); } $: disabled = !$focusedInput || !editingInputIsRichText($focusedInput); diff --git a/ts/editor/rich-text-input/RichTextInput.svelte b/ts/editor/rich-text-input/RichTextInput.svelte index bf9656fc1..74abed4e9 100644 --- a/ts/editor/rich-text-input/RichTextInput.svelte +++ b/ts/editor/rich-text-input/RichTextInput.svelte @@ -117,6 +117,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html async function focus(): Promise { const richText = await richTextPromise; + richText.blur(); richText.focus(); }