Questions tagged [google-blockly]

Google Blockly is a JavaScript library for building visual programming editors. It adds an editor to your app that represents coding concepts as interlocking blocks. It outputs syntactically correct code in the programming language of your choice. It is an open-source project developed and maintained by the google team. Use this tag for questions regarding the implementation of this library or extending the functionality of this library.

Google's Blockly is a web-based, visual programming editor. Users can drag blocks together to build programs. All code is free and open source.

The Blockly library adds an editor to your app that represents coding concepts as interlocking blocks. It outputs syntactically correct code in the programming language of your choice. Custom blocks may be created to connect to your own application.

Blockly is being used by hundreds of projects, most of them educational: Blockly Games, App Inventor, Microsoft MakeCode, Ozo Blockly, micro bit, etc.

Important links

Standard lockup

enter image description here

72 questions
0
votes
0 answers

Highlight the full line of code being executed using JS Interpreter

I am using JS Interpreter to parse the code and highlight the line of code being executed, I want something like the below (see the video), where each line is highlighted. When using the JS Interpreter, I get the below (see the video), where parts…
SpaceX
  • 2,814
  • 2
  • 42
  • 68
0
votes
1 answer

Google Blockly - message0 linebreak / vertical space

I am creating a Google Blockly block with several checkboxes regarding date periods As this is very wide, I'd like to split it up into smaller sections. Specifically, it would be great if after Sunday it would put Holiday on a new line. I've looked…
Aventil
  • 31
  • 5
0
votes
1 answer

Svelte component text doesn't update

I'm using Blockly + SvelteJS, now I am trying to add language support. So I have Toolbox.svelte component that looks like this:
rllynotfox
  • 55
  • 4
0
votes
1 answer

Can't call any Blockly methods in index.html even though it works in other .js files and a workspace is shown

I'm trying to create a tool where you can create HTML pages using Blockly blocks. I already have a page that shows my workspace and my self-created block. Now I want to write a script that gets the code from the workspace. Normally there is a…
sanada089
  • 5
  • 2
0
votes
1 answer

How can I set the width of dropdown_field in Blockly?

The block is long because there are too many characters in the dropdown field. So I want to fix the number of characters or the length of the dropdown field. Please give me your advice ! Have a nice day Thank you :D
f1sker
  • 1
  • 1
0
votes
1 answer

Remove all the blocks dragged by the user in Blockly

I am using Blockly library for a project. I want to remove all the blocks dragged by the user from the toolbox on pressing the reset button. Can someone help with how can this be done. Which function do I have to use?
drishti
  • 1
  • 1
0
votes
1 answer

How can i use the blockly event to implement multiplayer cooperation!

I've read the blockly's doc, i know that i can get the blockly event by addChangeListener(event) removeChangeListener(event) these two functions. So i can get many types of blockly events, but how can i use these events to create a block. So the…
curry_klay
  • 21
  • 4
0
votes
1 answer

Detect when a block stop to be dragged

I'd like to trigger a function when the user stop to drag blocks around. But it seems blockly only support block creation/deletion/moving & change event detection, is there a way to do that?
0
votes
1 answer

How can I change the shape of blocks in Scratch/Blockly?

I am trying to change the shape and color of the blocks in Scratch. To do so, I am trying to modify the GitHub repo of scratch-blocks (https://github.com/LLK/scratch-blocks). There is a slight possibility that the repo I would have to change is the…
Daniel Cortild
  • 203
  • 1
  • 9
0
votes
1 answer

Why is Blockly not generating code for custom blocks?

While generating code for custom blocks in blockly, i am getting error Error: Language "Python" does not know how to generate code for block type "import_block". when logging in console. Following is the code for block…
Arbaz Sheikh
  • 217
  • 2
  • 10
0
votes
2 answers

Monitoring variable change done by jQuery inside component

I know this isn't optimal, but I have regular javascript code changing a variable that is property in my component. The reason for this is that I have dynamic javascript (that comes from Google Blockly) being run (eval) in my component. Here's the…
Francis Ducharme
  • 4,848
  • 6
  • 43
  • 81
0
votes
1 answer

Blockly restrict input_value to another block

In my Blockly project, I have two 3 blocks rcm_a, rcm_b and rcm_c. Blockly.defineBlocksWithJsonArray([{ "type": "rcm_c", "message0": "Requirement block- rcm_a: %1 rcm_b: %2", "args0": [ { "type": "input_value", "name":…
Akash Agarwal
  • 2,326
  • 1
  • 27
  • 57
0
votes
0 answers

Clear Blockly workspace without moving items to trash

I would like to use code to clear a Blockly workspace, and in some cases overwrite with new Blockly XML. The issue I am facing, however, is that Workspace.clear() moves current items to trash, which can be annoying when trying to reset a workspace,…
Geza Kerecsenyi
  • 1,127
  • 10
  • 27
0
votes
1 answer

Missing provider for goog.date when recompiling the build.py file - google blockly

We have added field_date in blockly.js file and trying to recompile the build.py file but when running, it is throwing an error of missing provider goog.date . How can we solve this issue we are using latest blockly version.
0
votes
1 answer

Composing complex code as string in javascript

I'm designing custom Blockly blocks with their own JavaScript code, when the code I'm trying to output as string is a one liner, that's not so complicated but when the code I'm trying to associate to my custom block, doing it by concatenation of…
Francis Ducharme
  • 4,848
  • 6
  • 43
  • 81