Skip to content

Commit

Permalink
got output block stage set up. event creates block dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
N-J-Martin committed Mar 4, 2024
1 parent bbad839 commit a047e3d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ pre, code {
min-width: 600px;
}

#blocklyDiv2 {
flex-basis: 100%;
height: 100%;
min-width: 600px;
}

#outputPane {
display: flex;
flex-direction: column;
Expand Down
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<div id="output"></div>
</div>
<div id="blocklyDiv"></div>
<div id="blocklyDiv2"></div>
</div>
</body>
</html>
9 changes: 8 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ const codeDiv = document.getElementById('generatedCode').firstChild;
const outputDiv = document.getElementById('output');
const blocklyDiv = document.getElementById('blocklyDiv');
const ws = Blockly.inject(blocklyDiv, {toolbox});

const blockOut = Blockly.inject(document.getElementById('blocklyDiv2'), {toolbox});
blockOut.addChangeListener(function addBlock(addNewBlockEvent){
addNewBlockEvent.run(true);
});
new Blockly.Events.BlockCreate(blockOut.newBlock("letting_be_expr"));
//blockOut.addTopBlock(blocks["letting_be_expr"]);
//console.log(blockOut.getTopBlocks());
//blockOut.cleanUp();
//variable category using https://www.npmjs.com/package/@blockly/plugin-typed-variable-modal.
// much of the code below is from the usage instructions

Expand Down

0 comments on commit a047e3d

Please sign in to comment.