From bd79a063cad818d19c6c14c47dd9567079a690d3 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 1 May 2023 11:17:09 +1000 Subject: [PATCH] Revert "Prevent MathJax editor from closing unexpectedly when selecting text (#2484)" This broke mouse selection of dropdowns, as code that set closeOnInsideClick never got a click signal as the floating area is closed before the click fires. https://forums.ankiweb.net/t/anki-2-1-62-beta-release-candidate/29302/21 This reverts commit e35a9383689c069fdbb07c835cea8349722cd925. --- ts/components/WithFloating.svelte | 4 ++-- ts/components/WithOverlay.svelte | 4 ++-- ts/sveltelib/event-store.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ts/components/WithFloating.svelte b/ts/components/WithFloating.svelte index 462c08b9e..50773fb83 100644 --- a/ts/components/WithFloating.svelte +++ b/ts/components/WithFloating.svelte @@ -17,7 +17,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import isClosingClick from "../sveltelib/closing-click"; import isClosingKeyup from "../sveltelib/closing-keyup"; import type { EventPredicateResult } from "../sveltelib/event-predicate"; - import { documentKeyup, documentMouseDown } from "../sveltelib/event-store"; + import { documentClick, documentKeyup } from "../sveltelib/event-store"; import portal from "../sveltelib/portal"; import type { PositioningCallback } from "../sveltelib/position/auto-update"; import autoUpdate from "../sveltelib/position/auto-update"; @@ -134,7 +134,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html return; } - const closingClick = isClosingClick(documentMouseDown, { + const closingClick = isClosingClick(documentClick, { reference, floating, inside: closeOnInsideClick, diff --git a/ts/components/WithOverlay.svelte b/ts/components/WithOverlay.svelte index b06d2ce34..ec5c50b9c 100644 --- a/ts/components/WithOverlay.svelte +++ b/ts/components/WithOverlay.svelte @@ -17,7 +17,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import isClosingClick from "../sveltelib/closing-click"; import isClosingKeyup from "../sveltelib/closing-keyup"; import type { EventPredicateResult } from "../sveltelib/event-predicate"; - import { documentKeyup, documentMouseDown } from "../sveltelib/event-store"; + import { documentClick, documentKeyup } from "../sveltelib/event-store"; import type { PositioningCallback } from "../sveltelib/position/auto-update"; import autoUpdate from "../sveltelib/position/auto-update"; import type { PositionAlgorithm } from "../sveltelib/position/position-algorithm"; @@ -105,7 +105,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html return; } - const closingClick = isClosingClick(documentMouseDown, { + const closingClick = isClosingClick(documentClick, { reference, floating, inside: closeOnInsideClick, diff --git a/ts/sveltelib/event-store.ts b/ts/sveltelib/event-store.ts index 2b7f3ef5a..0930919f4 100644 --- a/ts/sveltelib/event-store.ts +++ b/ts/sveltelib/event-store.ts @@ -34,7 +34,7 @@ function eventStore>( export default eventStore; -const documentMouseDown = eventStore(document, "mousedown", MouseEvent); +const documentClick = eventStore(document, "click", MouseEvent); const documentKeyup = eventStore(document, "keyup", KeyboardEvent); -export { documentKeyup, documentMouseDown }; +export { documentClick, documentKeyup };