saving XML now asks user for file name

zeedee
Stephen Gilardi 7 years ago
parent 7e43bd7469
commit c5e7163082
  1. 10
      blockly/apps/blocklyduino/blockly_helper.js

@ -38,14 +38,16 @@ function restore_blocks() {
function save() {
var xml = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace);
var data = Blockly.Xml.domToText(xml);
var fileName = window.prompt("What would you like to name your file?", "BlocklyDuino");
fileName = fileName + ".xml";
// Store data in blob.
// var builder = new BlobBuilder();
// builder.append(data);
// saveAs(builder.getBlob('text/plain;charset=utf-8'), 'blockduino.xml');
console.log("saving blob");
var blob = new Blob([data], {type: 'text/xml'});
saveAs(blob, 'blockduino.xml');
if(fileName != "null"){
var blob = new Blob([data], {type: 'text/xml'});
saveAs(blob, fileName);
}
}
/**

Loading…
Cancel
Save