Fix MathJax popup fails to appear when adding MathJax via Fx button

This commit is contained in:
hikaru-y 2022-12-12 22:46:24 +09:00
parent 968a14784f
commit 11115f59bc

View file

@ -6,6 +6,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import * as tr from "@tslib/ftl"; import * as tr from "@tslib/ftl";
import { getPlatformString } from "@tslib/shortcuts"; import { getPlatformString } from "@tslib/shortcuts";
import { wrapInternal } from "@tslib/wrap"; import { wrapInternal } from "@tslib/wrap";
import { tick } from "svelte";
import DropdownItem from "../../components/DropdownItem.svelte"; import DropdownItem from "../../components/DropdownItem.svelte";
import IconButton from "../../components/IconButton.svelte"; import IconButton from "../../components/IconButton.svelte";
@ -76,6 +77,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
$: disabled = !$focusedInput || !editingInputIsRichText($focusedInput); $: disabled = !$focusedInput || !editingInputIsRichText($focusedInput);
let showFloating = false; let showFloating = false;
let onHidden: (() => void) | null = null;
$: if (!showFloating) {
tick().then(() => {
onHidden?.();
onHidden = null;
});
}
</script> </script>
<WithFloating <WithFloating
@ -94,7 +102,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<Popover slot="floating" --popover-padding-inline="0"> <Popover slot="floating" --popover-padding-inline="0">
{#each dropdownItems as [callback, keyCombination, label]} {#each dropdownItems as [callback, keyCombination, label]}
<DropdownItem on:click={callback}> <DropdownItem on:click={() => (onHidden = callback)}>
<span>{label}</span> <span>{label}</span>
<span class="ms-auto ps-2 shortcut" <span class="ms-auto ps-2 shortcut"
>{getPlatformString(keyCombination)}</span >{getPlatformString(keyCombination)}</span