Made default value shown in inline box, removed non required line

This commit is contained in:
Tim Stallard 2017-03-18 11:07:43 +00:00
parent 2ff813d339
commit 95a01d5638
2 changed files with 2 additions and 3 deletions

View File

@ -14,7 +14,6 @@ module.exports = function(newDiagram){
accepted = confirm("This document contains Javascript. You should only allow this document to be opened if you trust the source."); accepted = confirm("This document contains Javascript. You should only allow this document to be opened if you trust the source.");
} }
if(accepted){ if(accepted){
if(newDiagramObject.state.filter((block)=>(block.type == "custom")).length) customCode = true;
Object.assign(diagram, newDiagramObject); Object.assign(diagram, newDiagramObject);
$("#workspace>*").remove(); $("#workspace>*").remove();
for(var block of diagram.state){ for(var block of diagram.state){

View File

@ -20,7 +20,7 @@ function blockPositionChange(event){ //fired when a block is moved or added
} }
} }
$("#blocks").on("mousedown", ".block>.main,.block>.inputs", function(event){ $("#blocks").on("mousedown", ".block>.main,.block>.inputs", function(event){ //add new block
var newBlock = { var newBlock = {
id: uuid.v4(), id: uuid.v4(),
position: { position: {
@ -38,7 +38,7 @@ $("#blocks").on("mousedown", ".block>.main,.block>.inputs", function(event){
.reduce((inputs, input)=>{ //turn this into an object .reduce((inputs, input)=>{ //turn this into an object
inputs[input] = { inputs[input] = {
joined: "", joined: "",
value: "" value: blocks[$(this).parent().data("type")].inputs[input].default || "" //use default value if present
}; };
return inputs; return inputs;
}, {}), }, {}),