From aa1df6183c633a77a943358491e840fcc5aa601d Mon Sep 17 00:00:00 2001 From: Michael Aschauer Date: Mon, 13 Jul 2015 13:12:08 +0200 Subject: [PATCH] add save project to disc --- stitchcode/stitchcodeGUI.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/stitchcode/stitchcodeGUI.js b/stitchcode/stitchcodeGUI.js index 7c94ebe5..aea47587 100644 --- a/stitchcode/stitchcodeGUI.js +++ b/stitchcode/stitchcodeGUI.js @@ -996,6 +996,23 @@ IDE_Morph.prototype.downloadEXP = function() { saveAs(blob, (this.projectName ? this.projectName : 'turtlestitch') + '.exp'); } +IDE_Morph.prototype.saveProjectToDisk = function() { + var data, + blob; + + if (Process.prototype.isCatchingErrors) { + try { + data = this.serializer.serialize(this.stage); + } catch (err) { + this.showMessage('Saving failed: ' + err); + } + } else { + data = this.serializer.serialize(this.stage); + } + + blob = new Blob([data], {type: 'text/xml;charset=utf-8'}); + saveAs(blob, (this.projectName ? this.projectName : 'turtlestitch_project') + '.xml'); +} @@ -1389,6 +1406,7 @@ IDE_Morph.prototype.projectMenu = function () { ); } menu.addItem('Save As...', 'saveProjectsBrowser'); + menu.addItem('Save to disk', 'saveProjectToDisk'); menu.addLine(); menu.addItem( 'Import...',