mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Widgets implemented.
This commit is contained in:
@@ -29,10 +29,16 @@ export default class Tilorswift
|
||||
|
||||
static saveTerrainToFile(terrain)
|
||||
{
|
||||
let filename = prompt('Dateiname', 'terrain.json');
|
||||
|
||||
if (filename === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
let json = Tilorswift.getTerrainAsJson(terrain);
|
||||
let download = document.createElement('a');
|
||||
|
||||
download.setAttribute('download', 'terrain.json');
|
||||
download.setAttribute('download', filename);
|
||||
download.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(json));
|
||||
download.click();
|
||||
download.remove();
|
||||
|
||||
Reference in New Issue
Block a user