mirror of
https://github.com/coalaura/whiskr.git
synced 2025-12-02 20:22:52 +00:00
fix saving file preview at times
This commit is contained in:
@@ -47,12 +47,19 @@
|
||||
if ((event.ctrlKey || event.metaKey) && key === "s") {
|
||||
event.preventDefault();
|
||||
|
||||
const el = document.createElement("a");
|
||||
const blob = new Blob([data.content], {
|
||||
type: "text/plain;charset=utf-8",
|
||||
});
|
||||
|
||||
const el = document.createElement("a"),
|
||||
url = URL.createObjectURL(blob);
|
||||
|
||||
el.download = data.name;
|
||||
el.href = `data:text/plain;base64,${btoa(data.content)}`;
|
||||
el.href = url;
|
||||
|
||||
el.click();
|
||||
|
||||
setTimeout(() => URL.revokeObjectURL(url), 100);
|
||||
} else if ((event.ctrlKey || event.metaKey) && key === "a") {
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user