Allow preview of thread images

This commit is contained in:
N Pex 2023-08-07 15:47:52 +00:00
parent e43b08dc64
commit 0ff2884429
5 changed files with 95 additions and 38 deletions

View file

@ -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();