+ Pad Types::Downloads

This commit is contained in:
Daniel Legt 2022-06-01 17:00:23 +03:00
parent 6177dcecb8
commit 70b671c0be
2 changed files with 9 additions and 2 deletions

View File

@ -55,7 +55,8 @@ main#main-card {
} }
#textarea-preview { #textarea-preview {
max-height: calc(20rem + 30vh); max-height: calc(17rem + 30vh);
min-height: 17rem;
overflow: auto; overflow: auto;
} }

View File

@ -14,8 +14,14 @@ class Pad {
// Create a new blob of the contents of the pad // Create a new blob of the contents of the pad
var blob = new Blob([ document.getElementById(`pad-content`).value ], { type: "text/plain;charset=utf-8" }); var blob = new Blob([ document.getElementById(`pad-content`).value ], { type: "text/plain;charset=utf-8" });
let downloadFileName = this.title;
if ( !this.title.includes(`.`) ) {
// Append a default file format
downloadFileName += `.txt`;
}
// Save the blob as // Save the blob as
saveAs(blob, `${this.title}.txt`); saveAs(blob, `${downloadFileName}`);
} }
} }