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:
parent
e1446f01e4
commit
b1091a22a3
1 changed files with 14 additions and 7 deletions
|
@ -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")}
|
||||||
|
|
Loading…
Reference in a new issue