commit
c1be154c95
|
@ -31,6 +31,18 @@ function restore_blocks() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Arduino generated code to local file.
|
||||
*/
|
||||
function saveCode() {
|
||||
var fileName = window.prompt('What would you like to name your file?', 'BlocklyDuino')
|
||||
//doesn't save if the user quits the save prompt
|
||||
if(fileName){
|
||||
var blob = new Blob([Blockly.Arduino.workspaceToCode()], {type: 'text/plain;charset=utf-8'});
|
||||
saveAs(blob, fileName + '.ino');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save blocks to local file.
|
||||
* better include Blob and FileSaver for browser compatibility
|
||||
|
|
|
@ -300,6 +300,7 @@ function init() {
|
|||
<button type="button" onclick="uploadClick()">Upload</button>
|
||||
<button type="button" onclick="resetClick()">Reset</button>
|
||||
<button onclick="discard()">Discard</button>
|
||||
<button onclick="saveCode()">Save Arduino Code</button>
|
||||
<button onclick="save()">Save XML</button>
|
||||
<button id="fakeload">Load XML</button>
|
||||
<input type="file" id="load" style="display: none;"/>
|
||||
|
|
Loading…
Reference in New Issue