You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
only override contextmenu if closeMenu is provided
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -91,20 +91,21 @@ export default class ContextualMenu extends React.Component {
|
|||||||
onContextMenu(e) {
|
onContextMenu(e) {
|
||||||
if (this.props.closeMenu) {
|
if (this.props.closeMenu) {
|
||||||
this.props.closeMenu();
|
this.props.closeMenu();
|
||||||
}
|
|
||||||
e.preventDefault();
|
|
||||||
const x = e.clientX;
|
|
||||||
const y = e.clientY;
|
|
||||||
|
|
||||||
setImmediate(() => {
|
e.preventDefault();
|
||||||
const clickEvent = document.createEvent('MouseEvents');
|
const x = e.clientX;
|
||||||
clickEvent.initMouseEvent(
|
const y = e.clientY;
|
||||||
'contextmenu', true, true, window, 0,
|
|
||||||
0, 0, x, y, false, false,
|
setImmediate(() => {
|
||||||
false, false, 0, null,
|
const clickEvent = document.createEvent('MouseEvents');
|
||||||
);
|
clickEvent.initMouseEvent(
|
||||||
document.elementFromPoint(x, y).dispatchEvent(clickEvent);
|
'contextmenu', true, true, window, 0,
|
||||||
});
|
0, 0, x, y, false, false,
|
||||||
|
false, false, 0, null,
|
||||||
|
);
|
||||||
|
document.elementFromPoint(x, y).dispatchEvent(clickEvent);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
Reference in New Issue
Block a user