Beginning of menu implementation for importing files
This commit is contained in:
@@ -96,14 +96,21 @@ function importFromJson(json) {
|
||||
}
|
||||
|
||||
function exportToFile() {
|
||||
const name = 'placeholder.fsm';
|
||||
const json = exportToJson();
|
||||
if(activeDocument === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const document = documents[activeDocument];
|
||||
const name = `${new Date(document.createdAt).toLocaleDateString()} - ${document.name || 'Unbenannt'}.fsm`;
|
||||
const json = exportToJson(document);
|
||||
downloadFile(name, json, 'application/json');
|
||||
}
|
||||
|
||||
function downloadFile(name, content, type) {
|
||||
const element = document.createElement('a');
|
||||
|
||||
console.log(content);
|
||||
|
||||
element.setAttribute('href', `data:${type},charset=utf-8,${content}`);
|
||||
element.setAttribute('download', name);
|
||||
|
||||
|
Reference in New Issue
Block a user