mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 11:15:53 +03:00
Make download into a button
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
a6bb203a4b
commit
b068a4c055
1 changed files with 12 additions and 5 deletions
|
@ -169,6 +169,15 @@ export default class ImageView extends React.Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDownloadClick = (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.href = this.props.src;
|
||||||
|
a.download = this.props.name;
|
||||||
|
a.click();
|
||||||
|
}
|
||||||
|
|
||||||
onPanelClick = (ev) => {
|
onPanelClick = (ev) => {
|
||||||
this.props.onFinished();
|
this.props.onFinished();
|
||||||
}
|
}
|
||||||
|
@ -281,13 +290,11 @@ export default class ImageView extends React.Component {
|
||||||
title={_t("Zoom in")}
|
title={_t("Zoom in")}
|
||||||
onClick={ this.onZoomInClick }>
|
onClick={ this.onZoomInClick }>
|
||||||
</AccessibleTooltipButton>
|
</AccessibleTooltipButton>
|
||||||
<a
|
<AccessibleTooltipButton
|
||||||
className="mx_ImageView_button mx_ImageView_button_download"
|
className="mx_ImageView_button mx_ImageView_button_download"
|
||||||
href={ this.props.src }
|
|
||||||
download={ this.props.name }
|
|
||||||
title={_t("Download")}
|
title={_t("Download")}
|
||||||
target="_blank" rel="noopener">
|
onClick={ this.onDownloadClick }>
|
||||||
</a>
|
</AccessibleTooltipButton>
|
||||||
<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