Ensure that lastClickEvent is set before handling doubleClick (#23865)

GitOrigin-RevId: 1f080e62e95dc71cec6bcf2f5c9e0cb8bd5f5e2c
This commit is contained in:
Alf Eaton
2025-02-25 10:43:32 +00:00
committed by Copybot
parent 59b708e3f7
commit 1fd9c592e2

View File

@@ -84,13 +84,13 @@ const chooseEventHandler = () => {
}
// Store and use the previous click event, as the "dblclick" event can have the wrong position
let lastClickEvent: MouseEvent
let lastClickEvent: MouseEvent | null = null
return EditorView.domEventHandlers({
click(evt, view) {
if (evt.detail === 1) {
lastClickEvent = evt
} else if (evt.detail === 2) {
} else if (evt.detail === 2 && lastClickEvent) {
return handleDoubleClick(lastClickEvent, view)
}
},