Can't require blockly directly
See original GitHub issueI want to use budo to develop a blockly application. Therefore I need to require blockly directly. In order to export Blockly and goog as global variables I’ve modified the “blockly_compressed.js” file and added these two lines at the end of the file
window.Blockly = Blockly;
window.goog = goog;
My index.js looks like this
require('./blockly_compressed');
require('./blocks_compressed');
require('./javascript_compressed');
require('./msg/js/en');
document.body.innerHTML = `
<xml id="toolbox" style="display: none">
<block type="controls_if"></block>
<block type="controls_repeat_ext"></block>
<block type="logic_compare"></block>
<block type="math_number"></block>
<block type="math_arithmetic"></block>
<block type="text"></block>
<block type="text_print"></block>
</xml>
`;
var workspace = Blockly.inject('blocklyDiv',
{toolbox: document.getElementById('toolbox')});
When I run the application with budo index.js I get the following exception:
blockly_compressed.js:1437
Uncaught Error: container is not in current document.
Blockly.inject @ blockly_compressed.js:1437
5../blockly_compressed @ test.js [sm]:33
s @ _prelude.js:1
e @ _prelude.js:1
(anonymous function) @ _prelude.js:1
Can anyone give my a hint what I’m doing wrong? Thanks 😃
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Can't require blockly directly - Google Groups
I want to use budo to develop a blockly application. Therefore I need to require blockly directly. In order to export Blockly and...
Read more >Get Started | Blockly - Google Developers
Blockly is 100% client side, requiring no support from the server. There are no 3rd party dependencies. Everything is open source. Get the...
Read more >Can't call any Blockly methods in index.html even though it ...
Blockly object, so there is no such window. workspace variable that would be created unless one of your other scripts (not shown) created...
Read more >Getting started with Blockly
Blockly is a library for building block programming apps. ... Blockly includes everything you need for defining and rendering blocks in a drag-n-drop...
Read more >Anybody Can Code With Blockly - Strumenta
Notice that it is not immediately obvious how the blocks will look and work just by looking at the toolbox configuration. You do...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi green-coder,
We’re aware that this is a pain point for some of our developers, and it’s definitely on our to-do list.
Hi green-coder,
What Rachel means is you should try e-mailing the list. There are a lot more people with experience in different setups on the mailing list who can help debug specific problems. We try to keep the issue tracker just for feature requests and bugs.