Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/ts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@ function copyToClipboard(str: string): void {
// Saves a string to a particular client-side file
function saveFile(filename: string, text: string): void {
const element = document.createElement("a");
element.setAttribute("href", "data:text/text;charset=utf-8," + encodeURI(text));
element.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(text));
element.setAttribute("download", filename);

element.style.display = "none";
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}

// Sends a string to the printer
Expand Down