Allow preview of thread images
This commit is contained in:
parent
e43b08dc64
commit
0ff2884429
5 changed files with 95 additions and 38 deletions
|
|
@ -889,6 +889,27 @@ class Util {
|
|||
})
|
||||
});
|
||||
}
|
||||
|
||||
download(matrixClient, event) {
|
||||
this
|
||||
.getAttachment(matrixClient, event)
|
||||
.then((url) => {
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.target = "_blank";
|
||||
link.download = event.getContent().body || this.$t("fallbacks.download_name");
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
setTimeout(function () {
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(url);
|
||||
}, 200);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("Failed to fetch attachment: ", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
export default new Util();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue