Treat a contextmenu event as a mouseup event (#14754)

GitOrigin-RevId: 8f4f3cf53ccf09fd5e4c4a504d40cc375aa12b6c
This commit is contained in:
Alf Eaton 2023-09-11 11:00:22 +01:00 committed by Copybot
parent 13bbea4ced
commit 84a697de4f

View file

@ -99,6 +99,14 @@ const mouseDownListener = EditorView.domEventHandlers({
})
})
},
contextmenu: (event: MouseEvent, view) => {
// treat a `contextmenu` event as a `mouseup` event, which isn't fired
window.setTimeout(() => {
view.dispatch({
effects: mouseDownEffect.of(false),
})
})
},
})
const mousedownSelectionState = StateField.define<EditorSelection | undefined>({