From 4af10054df4c99e54961ec8c6b5660dbce20c8ef Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Mon, 29 Jul 2024 13:30:16 +0100 Subject: [PATCH] Ensure that the visual editor recognises a "drop" event as a "mouseup" (#19560) GitOrigin-RevId: 967d3c80a1501ffdfe9a7e3e978cba746a54d7b3 --- .../features/source-editor/extensions/visual/selection.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/web/frontend/js/features/source-editor/extensions/visual/selection.ts b/services/web/frontend/js/features/source-editor/extensions/visual/selection.ts index d60eb283d4..5c0dc20bd9 100644 --- a/services/web/frontend/js/features/source-editor/extensions/visual/selection.ts +++ b/services/web/frontend/js/features/source-editor/extensions/visual/selection.ts @@ -107,6 +107,14 @@ const mouseDownListener = EditorView.domEventHandlers({ }) }) }, + drop: (event: MouseEvent, view) => { + // treat a `drop` event as a `mouseup` event, which isn't fired + window.setTimeout(() => { + view.dispatch({ + effects: mouseDownEffect.of(false), + }) + }) + }, }) const mousedownSelectionState = StateField.define({