From f51d1590a18d063770d0e8872f4a06ad51ab23d2 Mon Sep 17 00:00:00 2001 From: Hikaru Y Date: Mon, 19 Dec 2022 11:07:47 +0900 Subject: [PATCH] Fix possible unexpected flash of pop-up menu (#2274) When a pop-up menu was closed by clicking on an empty space outside the fields, the variable controlling the display state was not changed, causing the pop-up menu to flash momentarily the next time a field was focused. --- ts/editor/editor-toolbar/BlockButtons.svelte | 5 ++++- ts/editor/editor-toolbar/LatexButton.svelte | 5 ++++- ts/editor/editor-toolbar/RemoveFormatButton.svelte | 9 ++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ts/editor/editor-toolbar/BlockButtons.svelte b/ts/editor/editor-toolbar/BlockButtons.svelte index 65f14cc7d..e68ed8b13 100644 --- a/ts/editor/editor-toolbar/BlockButtons.svelte +++ b/ts/editor/editor-toolbar/BlockButtons.svelte @@ -72,6 +72,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html $: disabled = !$focusedInput || !editingInputIsRichText($focusedInput); let showFloating = false; + $: if (disabled) { + showFloating = false; + } @@ -100,7 +103,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html (showFloating = false)} let:asReference diff --git a/ts/editor/editor-toolbar/LatexButton.svelte b/ts/editor/editor-toolbar/LatexButton.svelte index f511c3b31..232bed227 100644 --- a/ts/editor/editor-toolbar/LatexButton.svelte +++ b/ts/editor/editor-toolbar/LatexButton.svelte @@ -76,10 +76,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html $: disabled = !$focusedInput || !editingInputIsRichText($focusedInput); let showFloating = false; + $: if (disabled) { + showFloating = false; + } (showFloating = false)} diff --git a/ts/editor/editor-toolbar/RemoveFormatButton.svelte b/ts/editor/editor-toolbar/RemoveFormatButton.svelte index a57706419..46e31beab 100644 --- a/ts/editor/editor-toolbar/RemoveFormatButton.svelte +++ b/ts/editor/editor-toolbar/RemoveFormatButton.svelte @@ -62,6 +62,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let disabled: boolean; let showFloating = false; + $: if (disabled) { + showFloating = false; + } onMount(() => { const surroundElement = document.createElement("span"); @@ -114,11 +117,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - (showFloating = false)} -> + (showFloating = false)}>