From 00e0b1928f43dcaabbd09025366f79017f7f4f27 Mon Sep 17 00:00:00 2001 From: Coder of Salvation / Leon van Kammen Date: Fri, 26 Oct 2018 12:46:56 +0200 Subject: [PATCH] save to file (dialog) --- editor/js/Menubar.File.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/editor/js/Menubar.File.js b/editor/js/Menubar.File.js index dc46627..f77536f 100755 --- a/editor/js/Menubar.File.js +++ b/editor/js/Menubar.File.js @@ -79,11 +79,13 @@ Menubar.File = function ( editor ) { var output = JSON.stringify( editor.toJSON(), null, '\t' ); - var blob = new Blob( [ output ], { type: 'text/plain' } ); - var objectURL = URL.createObjectURL( blob ); - - window.open( objectURL, '_blank' ); - window.focus(); + var filename = "framejs.json" + var contentType = 'application/octet-stream'; + var a = document.createElement('a'); + var blob = new Blob([output], {'type':contentType}); + a.href = window.URL.createObjectURL(blob); + a.download = filename; + a.click() }