Prevent MathJax editor from closing unexpectedly when selecting text (#2484)
* Prevent MathJax editor from closing unexpectedly when selecting text * Revert "Prevent MathJax editor from closing unexpectedly when selecting text" This reverts commit b43d33a6de36d0af38933c6dae8bdd635294effd. * Prevent floating/overlay element from closing when selecting text Apply suggestions from code review. Use a 'mousedown' event instead of a 'click' event so that releasing the mouse button at the end of a text selection operation when the pointer is outside a floating/overlay element does not close it. Co-authored-by: Damien Elmes <dae@users.noreply.github.com> --------- Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
This commit is contained in:
parent
894b7862e3
commit
e35a938368
@ -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 { documentClick, documentKeyup } from "../sveltelib/event-store";
|
||||
import { documentKeyup, documentMouseDown } 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(documentClick, {
|
||||
const closingClick = isClosingClick(documentMouseDown, {
|
||||
reference,
|
||||
floating,
|
||||
inside: closeOnInsideClick,
|
||||
|
@ -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 { documentClick, documentKeyup } from "../sveltelib/event-store";
|
||||
import { documentKeyup, documentMouseDown } 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(documentClick, {
|
||||
const closingClick = isClosingClick(documentMouseDown, {
|
||||
reference,
|
||||
floating,
|
||||
inside: closeOnInsideClick,
|
||||
|
@ -34,7 +34,7 @@ function eventStore<T extends EventTarget, K extends keyof EventTargetToMap<T>>(
|
||||
|
||||
export default eventStore;
|
||||
|
||||
const documentClick = eventStore(document, "click", MouseEvent);
|
||||
const documentMouseDown = eventStore(document, "mousedown", MouseEvent);
|
||||
const documentKeyup = eventStore(document, "keyup", KeyboardEvent);
|
||||
|
||||
export { documentClick, documentKeyup };
|
||||
export { documentKeyup, documentMouseDown };
|
||||
|
Loading…
Reference in New Issue
Block a user