You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Don't render context menu button if mxEvent is missing
The button is useless and doesn't work if we're viewing an avatar Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -359,6 +359,19 @@ export default class ImageView extends React.Component<IProps, IState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let contextMenuButton;
|
||||||
|
if (this.props.mxEvent) {
|
||||||
|
contextMenuButton = (
|
||||||
|
<ContextMenuTooltipButton
|
||||||
|
className="mx_ImageView_button mx_ImageView_button_more"
|
||||||
|
title={_t("Options")}
|
||||||
|
onClick={this.onOpenContextMenu}
|
||||||
|
inputRef={this.contextMenuButton}
|
||||||
|
isExpanded={this.state.contextMenuDisplayed}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FocusLock
|
<FocusLock
|
||||||
returnFocus={true}
|
returnFocus={true}
|
||||||
@@ -397,13 +410,7 @@ export default class ImageView extends React.Component<IProps, IState> {
|
|||||||
title={_t("Download")}
|
title={_t("Download")}
|
||||||
onClick={ this.onDownloadClick }>
|
onClick={ this.onDownloadClick }>
|
||||||
</AccessibleTooltipButton>
|
</AccessibleTooltipButton>
|
||||||
<ContextMenuTooltipButton
|
{contextMenuButton}
|
||||||
className="mx_ImageView_button mx_ImageView_button_more"
|
|
||||||
title={_t("Options")}
|
|
||||||
onClick={this.onOpenContextMenu}
|
|
||||||
inputRef={this.contextMenuButton}
|
|
||||||
isExpanded={this.state.contextMenuDisplayed}
|
|
||||||
/>
|
|
||||||
<AccessibleTooltipButton
|
<AccessibleTooltipButton
|
||||||
className="mx_ImageView_button mx_ImageView_button_close"
|
className="mx_ImageView_button mx_ImageView_button_close"
|
||||||
title={_t("Close")}
|
title={_t("Close")}
|
||||||
|
|||||||
Reference in New Issue
Block a user