You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-11 20:22:36 +03:00
Make download into a button
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -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")}
|
||||||
|
|||||||
Reference in New Issue
Block a user