Skip to content

Commit

Permalink
fix displaying saved data in another window
Browse files Browse the repository at this point in the history
  • Loading branch information
hlorenzi committed Dec 11, 2018
1 parent 4687a39 commit 0bcc2ba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions run_local_server.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
where /q http-server

IF ERRORLEVEL 1 (npm i -g http-server)

http-server -p 80
12 changes: 8 additions & 4 deletions src/toolbox_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ function toolboxLoadString()
function toolboxSaveString()
{
var songData = g_Song.saveJSON();
var data = "data:text/plain," + encodeURIComponent(songData);
window.open(data);
var newWindow = window.open();
newWindow.document.write("<code style='white-space:pre'>");
newWindow.document.write(songData);
newWindow.document.write("</code>");
g_Editor.setUnsavedChanges(false);
}

Expand All @@ -76,8 +78,10 @@ function toolboxLoadCompressed()
function toolboxSaveCompressed()
{
var songData = g_Song.saveBinary();
var data = "data:text/plain," + encodeURIComponent(songData);
window.open(data);
var newWindow = window.open();
newWindow.document.write("<code style='white-space:pre'>");
newWindow.document.write(songData);
newWindow.document.write("</code>");
g_Editor.setUnsavedChanges(false);
}

Expand Down

0 comments on commit 0bcc2ba

Please sign in to comment.