You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -80,6 +80,6 @@ you will never need to make a new `ContextMenuRegistry`. Always use the singleto
80
80
81
81
Reload your web page and open a context menu on the workspace (right-click with a mouse, or press `Ctrl+Enter` (Windows) or `Command+Enter` (Mac) if you are navigating Blockly with the keyboard). You should see a new option labeled "Hello World" at the bottom of the context menu.
82
82
83
-
<ClassBlockclassName="codelabImages">  </ClassBlock>
83
+
<CodelabImage>  </CodelabImage>
84
84
85
85
Next, drag a block onto the workspace and open a context menu on the block. You'll see "Hello World" at the bottom of the block's context menu. Finally, open a context menu on the workspace and create a comment, then open a context menu on the comment's header. "Hello World" should be at the bottom of the context menu.
To run the code, simple open `starter-code/index.html` in a browser. You should see a Blockly workspace with an always-open flyout.
35
35
36
-
<ClassBlockclassName="codelabImages"></ClassBlock>
36
+
<CodelabImage></CodelabImage>
@@ -21,7 +21,7 @@ import ClassBlock from '@site/src/components/ClassBlock';
21
21
22
22
You will build a JSON generator that implements the [JSON language spec](https://www.json.org/json-en.html).
23
23
24
-
<ClassBlockclassName="codelabImages"></ClassBlock>
24
+
<CodelabImage></CodelabImage>
@@ -158,6 +158,6 @@ Our `index.js` file already handles importing the toolbox and using it in Blockl
158
158
159
159
If the server is already running, refresh the page to see changes. Otherwise, run `npm start` to start the server. New blocks should now exist in the toolbox, like this:
160
160
161
-
<ClassBlockclassName="codelabImages"></ClassBlock>
161
+
<CodelabImage></CodelabImage>
162
162
163
163
The app is still trying to generate and run JavaScript for the workspace, instead of JSON. We will change that soon.
<ClassBlockclassName="codelabImages"></ClassBlock>
36
+
<CodelabImage></CodelabImage>
37
37
38
38
Unlike `logic_null`, there is a single text input field on this block. Use `getFieldValue`:
<ClassBlockclassName="codelabImages"></ClassBlock>
58
+
<CodelabImage></CodelabImage>
59
59
60
60
Like the `text` block, the `math_number` block can use `getFieldValue`. Unlike the text block, the function doesn't need to wrap it in additional quotation marks, because in the JSON code, it won't be a string.
The `logic_boolean` block has a dropdown field named `BOOL`.
74
74
75
-
<ClassBlockclassName="codelabImages"></ClassBlock>
75
+
<CodelabImage></CodelabImage>
76
76
77
77
Calling `getFieldValue` on a dropdown field returns the value of the selected option, which may not be the same as the display text. In this case the dropdown has two possible values: `TRUE` and `FALSE`.
@@ -100,6 +100,6 @@ Your `setSelected` method should look similar to below:
100
100
If you open your `index.html` file, you should see a white gear above your "Logic"
101
101
label, and it should change to blue when the category has been selected.
102
102
103
-
<ClassBlockclassName="codelabImages">  </ClassBlock>
103
+
<CodelabImage>  </CodelabImage>
104
104
105
-
<ClassBlockclassName="codelabImages">  </ClassBlock>
105
+
<CodelabImage>  </CodelabImage>
@@ -85,7 +85,7 @@ Next, we are going to return this element:
85
85
86
86
If you open the `index.html` file you should see a label above your first category.
87
87
88
-
<ClassBlockclassName="codelabImages">  </ClassBlock>
88
+
<CodelabImage>  </CodelabImage>
89
89
90
90
### Add attributes to the toolbox definition
91
91
The above code is rather limiting since it only allows us to create a toolbox
@@ -119,7 +119,7 @@ All attributes on our toolbox definition get added to the `toolboxItemDef_`.
119
119
120
120
Open your `index.html` in a browser to see the updated label.
121
121
122
-
<ClassBlockclassName="codelabImages">  </ClassBlock>
122
+
<CodelabImage>  </CodelabImage>
123
123
124
124
### Add some CSS
125
125
Similar to how we added `colour` and `name` above, we are going to add a custom
@@ -159,4 +159,4 @@ the below CSS to make the label bold.
159
159
If you open `index.html` you should now see a bold dark gray label at the
160
160
top of your toolbox.
161
161
162
-
<ClassBlockclassName="codelabImages">  </ClassBlock>
162
+
<CodelabImage>  </CodelabImage>
If you open `index.html` you should now see the blockly logo on top of all your
35
35
categories
36
36
37
-
<ClassBlockclassName="codelabImages">  </ClassBlock>
37
+
<CodelabImage>  </CodelabImage>
@@ -45,7 +45,7 @@ For more information on Blockly styles please visit the [themes documentation](/
45
45
Open `index.html` to see your updated toolbox. Your toolbox should look
46
46
similar to the below toolbox.
47
47
48
-
<ClassBlockclassName="codelabImages">  </ClassBlock>
48
+
<CodelabImage>  </CodelabImage>
49
49
50
50
We are going to add some CSS to make it easier to read, and to space out our categories.
51
51
@@ -78,4 +78,4 @@ Copy and paste the following CSS into your `toolbox_style.css` file.
78
78
79
79
Open `index.html` to see your toolbox.
80
80
81
-
<ClassBlockclassName="codelabImages">  </ClassBlock>
81
+
<CodelabImage>  </CodelabImage>
Open `index.html` and click on the "Logic" category. You should now see a white
48
48
category with a colored label.
49
49
50
-
<ClassBlockclassName="codelabImages">  </ClassBlock>
50
+
<CodelabImage>  </CodelabImage>
0 commit comments