question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to add a block into block into canvas with js code.

See original GitHub issue

For example:

workspace.addBlockToCanvas('<block><field name='text'><value>123</value></field></block>')

Maybe not a good code. Just want some help about how to implement this function.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
NeilFrasercommented, Apr 9, 2016
var xml = Blockly.Xml.textToDom('<xml><block type="text" x="100" y="50"><field name="TEXT">123</field></block></xml>');
Blockly.Xml.domToWorkspace(xml, workspace);
0reactions
picklesruscommented, Apr 17, 2018

Hi @ceides9497 I don’t believe what you’re reporting is a bug so you’re better off asking for help over on the Blockly mailing list/forum: https://groups.google.com/forum/#!forum/blockly

That said, I think you’re confusing “blocks” and “shadow”. See https://developers.google.com/blockly/guides/configure/web/toolbox#shadow_blocks and if you have a follow up, please ask over on the mailing list.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Format a code block into Canvas. - Instructure Community
For the code element, press Alt+F9 within the Rich Content Editor to display the menu. Then go to Format and choose code. Canvas...
Read more >
Inserting Code Snippets - The Center For Learning & Teaching
Placing the code directly in Canvas · Switch to the html editor in Canvas, found via the </> icon to the lower right...
Read more >
Tokenizing markdown and drawing code blocks in canvas
In our snippet above, we're going to go through each line, see if it matches a code block, then depending on the current...
Read more >
How to add text in particular block of canvas - Stack Overflow
I would like to add text in a Rectangle block of my canvas.Please let me know how can I do this, My code...
Read more >
HTML5 Canvas Blocks #4 - CodePen
Add Class(es) to <html>. Adding Classes. In CodePen, whatever you write in the HTML editor is what goes within the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found