scratch-blocks 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/AGENTS.md +140 -0
  2. package/commitlint.config.js +2 -2
  3. package/dist/main.mjs +1 -2
  4. package/dist/types/msg/scratch_msgs.d.ts.map +1 -1
  5. package/dist/types/src/block_reporting.d.ts.map +1 -1
  6. package/dist/types/src/blocks/colour.d.ts +0 -19
  7. package/dist/types/src/blocks/colour.d.ts.map +1 -1
  8. package/dist/types/src/blocks/control.d.ts +0 -19
  9. package/dist/types/src/blocks/control.d.ts.map +1 -1
  10. package/dist/types/src/blocks/data.d.ts +0 -19
  11. package/dist/types/src/blocks/data.d.ts.map +1 -1
  12. package/dist/types/src/blocks/event.d.ts +0 -19
  13. package/dist/types/src/blocks/event.d.ts.map +1 -1
  14. package/dist/types/src/blocks/looks.d.ts +0 -19
  15. package/dist/types/src/blocks/looks.d.ts.map +1 -1
  16. package/dist/types/src/blocks/math.d.ts +0 -19
  17. package/dist/types/src/blocks/math.d.ts.map +1 -1
  18. package/dist/types/src/blocks/matrix.d.ts +0 -19
  19. package/dist/types/src/blocks/matrix.d.ts.map +1 -1
  20. package/dist/types/src/blocks/motion.d.ts +0 -19
  21. package/dist/types/src/blocks/motion.d.ts.map +1 -1
  22. package/dist/types/src/blocks/note.d.ts +0 -19
  23. package/dist/types/src/blocks/note.d.ts.map +1 -1
  24. package/dist/types/src/blocks/operators.d.ts +0 -19
  25. package/dist/types/src/blocks/operators.d.ts.map +1 -1
  26. package/dist/types/src/blocks/procedures.d.ts +6 -9
  27. package/dist/types/src/blocks/procedures.d.ts.map +1 -1
  28. package/dist/types/src/blocks/sensing.d.ts +0 -19
  29. package/dist/types/src/blocks/sensing.d.ts.map +1 -1
  30. package/dist/types/src/blocks/sound.d.ts +0 -19
  31. package/dist/types/src/blocks/sound.d.ts.map +1 -1
  32. package/dist/types/src/blocks/text.d.ts +0 -19
  33. package/dist/types/src/blocks/text.d.ts.map +1 -1
  34. package/dist/types/src/blocks/vertical_extensions.d.ts +0 -19
  35. package/dist/types/src/blocks/vertical_extensions.d.ts.map +1 -1
  36. package/dist/types/src/checkable_continuous_flyout.d.ts +2 -7
  37. package/dist/types/src/checkable_continuous_flyout.d.ts.map +1 -1
  38. package/dist/types/src/checkbox_bubble.d.ts +13 -12
  39. package/dist/types/src/checkbox_bubble.d.ts.map +1 -1
  40. package/dist/types/src/colours.d.ts.map +1 -1
  41. package/dist/types/src/constants.d.ts +0 -7
  42. package/dist/types/src/constants.d.ts.map +1 -1
  43. package/dist/types/src/context_menu_items.d.ts +0 -5
  44. package/dist/types/src/context_menu_items.d.ts.map +1 -1
  45. package/dist/types/src/data_category.d.ts +2 -4
  46. package/dist/types/src/data_category.d.ts.map +1 -1
  47. package/dist/types/src/events/events_block_comment_base.d.ts +2 -3
  48. package/dist/types/src/events/events_block_comment_base.d.ts.map +1 -1
  49. package/dist/types/src/events/events_block_comment_change.d.ts +0 -5
  50. package/dist/types/src/events/events_block_comment_change.d.ts.map +1 -1
  51. package/dist/types/src/events/events_block_comment_collapse.d.ts +0 -5
  52. package/dist/types/src/events/events_block_comment_collapse.d.ts.map +1 -1
  53. package/dist/types/src/events/events_block_comment_create.d.ts +0 -5
  54. package/dist/types/src/events/events_block_comment_create.d.ts.map +1 -1
  55. package/dist/types/src/events/events_block_comment_delete.d.ts +0 -5
  56. package/dist/types/src/events/events_block_comment_delete.d.ts.map +1 -1
  57. package/dist/types/src/events/events_block_comment_move.d.ts +0 -5
  58. package/dist/types/src/events/events_block_comment_move.d.ts.map +1 -1
  59. package/dist/types/src/events/events_block_comment_resize.d.ts +0 -5
  60. package/dist/types/src/events/events_block_comment_resize.d.ts.map +1 -1
  61. package/dist/types/src/events/events_block_drag_end.d.ts +1 -2
  62. package/dist/types/src/events/events_block_drag_end.d.ts.map +1 -1
  63. package/dist/types/src/events/events_block_drag_outside.d.ts +1 -2
  64. package/dist/types/src/events/events_block_drag_outside.d.ts.map +1 -1
  65. package/dist/types/src/events/events_scratch_variable_create.d.ts +0 -5
  66. package/dist/types/src/events/events_scratch_variable_create.d.ts.map +1 -1
  67. package/dist/types/src/fields/field_colour_slider.d.ts +7 -31
  68. package/dist/types/src/fields/field_colour_slider.d.ts.map +1 -1
  69. package/dist/types/src/fields/field_matrix.d.ts +0 -19
  70. package/dist/types/src/fields/field_matrix.d.ts.map +1 -1
  71. package/dist/types/src/fields/field_note.d.ts +8 -23
  72. package/dist/types/src/fields/field_note.d.ts.map +1 -1
  73. package/dist/types/src/fields/field_textinput_removable.d.ts +2 -4
  74. package/dist/types/src/fields/field_textinput_removable.d.ts.map +1 -1
  75. package/dist/types/src/fields/field_variable_getter.d.ts +0 -19
  76. package/dist/types/src/fields/field_variable_getter.d.ts.map +1 -1
  77. package/dist/types/src/fields/field_vertical_separator.d.ts +0 -19
  78. package/dist/types/src/fields/field_vertical_separator.d.ts.map +1 -1
  79. package/dist/types/src/fields/scratch_field_angle.d.ts +0 -19
  80. package/dist/types/src/fields/scratch_field_angle.d.ts.map +1 -1
  81. package/dist/types/src/fields/scratch_field_dropdown.d.ts +0 -5
  82. package/dist/types/src/fields/scratch_field_dropdown.d.ts.map +1 -1
  83. package/dist/types/src/fields/scratch_field_number.d.ts +0 -19
  84. package/dist/types/src/fields/scratch_field_number.d.ts.map +1 -1
  85. package/dist/types/src/fields/scratch_field_variable.d.ts +5 -8
  86. package/dist/types/src/fields/scratch_field_variable.d.ts.map +1 -1
  87. package/dist/types/src/flyout_checkbox_icon.d.ts +2 -3
  88. package/dist/types/src/flyout_checkbox_icon.d.ts.map +1 -1
  89. package/dist/types/src/glows.d.ts +1 -3
  90. package/dist/types/src/glows.d.ts.map +1 -1
  91. package/dist/types/src/index.d.ts +50 -51
  92. package/dist/types/src/index.d.ts.map +1 -1
  93. package/dist/types/src/procedures.d.ts +6 -8
  94. package/dist/types/src/procedures.d.ts.map +1 -1
  95. package/dist/types/src/recyclable_block_flyout_inflater.d.ts +3 -5
  96. package/dist/types/src/recyclable_block_flyout_inflater.d.ts.map +1 -1
  97. package/dist/types/src/renderer/bowler_hat.d.ts +2 -3
  98. package/dist/types/src/renderer/bowler_hat.d.ts.map +1 -1
  99. package/dist/types/src/renderer/cat/cat_face.d.ts +6 -5
  100. package/dist/types/src/renderer/cat/cat_face.d.ts.map +1 -1
  101. package/dist/types/src/renderer/cat/constants.d.ts +2 -2
  102. package/dist/types/src/renderer/cat/constants.d.ts.map +1 -1
  103. package/dist/types/src/renderer/cat/drawer.d.ts +4 -5
  104. package/dist/types/src/renderer/cat/drawer.d.ts.map +1 -1
  105. package/dist/types/src/renderer/cat/path_object.d.ts +2 -3
  106. package/dist/types/src/renderer/cat/path_object.d.ts.map +1 -1
  107. package/dist/types/src/renderer/cat/render_info.d.ts +3 -4
  108. package/dist/types/src/renderer/cat/render_info.d.ts.map +1 -1
  109. package/dist/types/src/renderer/cat/renderer.d.ts +7 -8
  110. package/dist/types/src/renderer/cat/renderer.d.ts.map +1 -1
  111. package/dist/types/src/renderer/constants.d.ts +41 -0
  112. package/dist/types/src/renderer/constants.d.ts.map +1 -0
  113. package/dist/types/src/renderer/drawer.d.ts +7 -6
  114. package/dist/types/src/renderer/drawer.d.ts.map +1 -1
  115. package/dist/types/src/renderer/path_object.d.ts +1 -3
  116. package/dist/types/src/renderer/path_object.d.ts.map +1 -1
  117. package/dist/types/src/renderer/render_info.d.ts +3 -4
  118. package/dist/types/src/renderer/render_info.d.ts.map +1 -1
  119. package/dist/types/src/renderer/renderer.d.ts +9 -16
  120. package/dist/types/src/renderer/renderer.d.ts.map +1 -1
  121. package/dist/types/src/scratch_block_paster.d.ts +0 -5
  122. package/dist/types/src/scratch_block_paster.d.ts.map +1 -1
  123. package/dist/types/src/scratch_blocks_utils.d.ts +0 -20
  124. package/dist/types/src/scratch_blocks_utils.d.ts.map +1 -1
  125. package/dist/types/src/scratch_comment_bubble.d.ts +3 -6
  126. package/dist/types/src/scratch_comment_bubble.d.ts.map +1 -1
  127. package/dist/types/src/scratch_comment_icon.d.ts +3 -4
  128. package/dist/types/src/scratch_comment_icon.d.ts.map +1 -1
  129. package/dist/types/src/scratch_connection_checker.d.ts +0 -5
  130. package/dist/types/src/scratch_connection_checker.d.ts.map +1 -1
  131. package/dist/types/src/scratch_continuous_category.d.ts +5 -5
  132. package/dist/types/src/scratch_continuous_category.d.ts.map +1 -1
  133. package/dist/types/src/scratch_continuous_toolbox.d.ts +3 -6
  134. package/dist/types/src/scratch_continuous_toolbox.d.ts.map +1 -1
  135. package/dist/types/src/scratch_dragger.d.ts +2 -11
  136. package/dist/types/src/scratch_dragger.d.ts.map +1 -1
  137. package/dist/types/src/scratch_insertion_marker_previewer.d.ts +0 -5
  138. package/dist/types/src/scratch_insertion_marker_previewer.d.ts.map +1 -1
  139. package/dist/types/src/scratch_variable_map.d.ts +0 -5
  140. package/dist/types/src/scratch_variable_map.d.ts.map +1 -1
  141. package/dist/types/src/scratch_variable_model.d.ts +2 -3
  142. package/dist/types/src/scratch_variable_model.d.ts.map +1 -1
  143. package/dist/types/src/scratch_zoom_controls.d.ts +4 -6
  144. package/dist/types/src/scratch_zoom_controls.d.ts.map +1 -1
  145. package/dist/types/src/shadows.d.ts +2 -2
  146. package/dist/types/src/shadows.d.ts.map +1 -1
  147. package/dist/types/src/status_indicator_label.d.ts +4 -6
  148. package/dist/types/src/status_indicator_label.d.ts.map +1 -1
  149. package/dist/types/src/status_indicator_label_flyout_inflater.d.ts +1 -6
  150. package/dist/types/src/status_indicator_label_flyout_inflater.d.ts.map +1 -1
  151. package/dist/types/src/variables.d.ts +4 -8
  152. package/dist/types/src/variables.d.ts.map +1 -1
  153. package/dist/types/src/xml.d.ts +2 -3
  154. package/dist/types/src/xml.d.ts.map +1 -1
  155. package/dist/types/tests/jsunit/block_test.d.ts.map +1 -1
  156. package/dist/types/tests/jsunit/connection_db_test.d.ts +3 -3
  157. package/dist/types/tests/jsunit/connection_db_test.d.ts.map +1 -1
  158. package/dist/types/tests/jsunit/connection_test.d.ts.map +1 -1
  159. package/dist/types/tests/jsunit/event_test.d.ts.map +1 -1
  160. package/dist/types/tests/jsunit/extensions_test.d.ts.map +1 -1
  161. package/dist/types/tests/jsunit/field_number_test.d.ts.map +1 -1
  162. package/dist/types/tests/jsunit/field_test.d.ts.map +1 -1
  163. package/dist/types/tests/jsunit/field_variable_getter_test.d.ts.map +1 -1
  164. package/dist/types/tests/jsunit/field_variable_test.d.ts.map +1 -1
  165. package/dist/types/tests/jsunit/gesture_test.d.ts.map +1 -1
  166. package/dist/types/tests/jsunit/input_test.d.ts +1 -0
  167. package/dist/types/tests/jsunit/input_test.d.ts.map +1 -1
  168. package/dist/types/tests/jsunit/json_test.d.ts.map +1 -1
  169. package/dist/types/tests/jsunit/names_test.d.ts.map +1 -1
  170. package/dist/types/tests/jsunit/procedure_test.d.ts.map +1 -1
  171. package/dist/types/tests/jsunit/scratch_block_comment_test.d.ts.map +1 -1
  172. package/dist/types/tests/jsunit/svg_test.d.ts.map +1 -1
  173. package/dist/types/tests/jsunit/test_utilities.d.ts.map +1 -1
  174. package/dist/types/tests/jsunit/utils_test.d.ts.map +1 -1
  175. package/dist/types/tests/jsunit/variable_map_test.d.ts.map +1 -1
  176. package/dist/types/tests/jsunit/variable_model_test.d.ts.map +1 -1
  177. package/dist/types/tests/jsunit/widget_div_test.d.ts.map +1 -1
  178. package/dist/types/tests/jsunit/workspace_comment_test.d.ts.map +1 -1
  179. package/dist/types/tests/jsunit/workspace_test.d.ts.map +1 -1
  180. package/dist/types/tests/jsunit/workspace_undo_redo_test.d.ts.map +1 -1
  181. package/dist/types/tests/jsunit/xml_test.d.ts.map +1 -1
  182. package/dist/types/tests/workspace_svg/workspace_svg_test.d.ts.map +1 -1
  183. package/eslint.config.mjs +69 -0
  184. package/i18n/create_scratch_msgs.js +44 -45
  185. package/i18n/js_to_json.js +40 -32
  186. package/i18n/json_to_js.js +37 -37
  187. package/i18n/sync_tx_translations.js +64 -65
  188. package/i18n/test_scratch_msgs.js +66 -63
  189. package/msg/js/en.js +289 -287
  190. package/msg/json/en.json +284 -284
  191. package/msg/messages.js +289 -287
  192. package/msg/scratch_msgs.js +22959 -22970
  193. package/package.json +13 -10
  194. package/prettier.config.mjs +3 -0
  195. package/release.config.js +7 -7
  196. package/renovate.json5 +7 -9
  197. package/src/block_reporting.ts +16 -19
  198. package/src/blocks/colour.ts +12 -15
  199. package/src/blocks/control.ts +171 -174
  200. package/src/blocks/data.ts +233 -272
  201. package/src/blocks/event.ts +121 -123
  202. package/src/blocks/looks.ts +165 -167
  203. package/src/blocks/math.ts +44 -46
  204. package/src/blocks/matrix.ts +11 -13
  205. package/src/blocks/motion.ts +151 -153
  206. package/src/blocks/note.ts +11 -13
  207. package/src/blocks/operators.ts +158 -160
  208. package/src/blocks/procedures.ts +421 -511
  209. package/src/blocks/sensing.ts +163 -165
  210. package/src/blocks/sound.ts +58 -60
  211. package/src/blocks/text.ts +10 -12
  212. package/src/blocks/vertical_extensions.ts +86 -102
  213. package/src/checkable_continuous_flyout.ts +25 -42
  214. package/src/checkbox_bubble.ts +83 -100
  215. package/src/colours.ts +35 -37
  216. package/src/constants.ts +22 -29
  217. package/src/context_menu_items.ts +59 -84
  218. package/src/css.ts +3 -4
  219. package/src/data_category.ts +137 -251
  220. package/src/events/events_block_comment_base.ts +23 -30
  221. package/src/events/events_block_comment_change.ts +21 -42
  222. package/src/events/events_block_comment_collapse.ts +27 -36
  223. package/src/events/events_block_comment_create.ts +32 -46
  224. package/src/events/events_block_comment_delete.ts +12 -19
  225. package/src/events/events_block_comment_move.ts +27 -52
  226. package/src/events/events_block_comment_resize.ts +28 -55
  227. package/src/events/events_block_drag_end.ts +16 -26
  228. package/src/events/events_block_drag_outside.ts +12 -22
  229. package/src/events/events_scratch_variable_create.ts +37 -42
  230. package/src/fields/field_colour_slider.ts +186 -216
  231. package/src/fields/field_matrix.ts +202 -270
  232. package/src/fields/field_note.ts +277 -375
  233. package/src/fields/field_textinput_removable.ts +25 -40
  234. package/src/fields/field_variable_getter.ts +26 -31
  235. package/src/fields/field_vertical_separator.ts +19 -24
  236. package/src/fields/scratch_field_angle.ts +151 -187
  237. package/src/fields/scratch_field_dropdown.ts +15 -19
  238. package/src/fields/scratch_field_number.ts +125 -181
  239. package/src/fields/scratch_field_variable.ts +57 -75
  240. package/src/flyout_checkbox_icon.ts +18 -28
  241. package/src/glows.ts +52 -59
  242. package/src/index.ts +119 -133
  243. package/src/procedures.ts +150 -209
  244. package/src/recyclable_block_flyout_inflater.ts +14 -25
  245. package/src/renderer/bowler_hat.ts +6 -8
  246. package/src/renderer/cat/cat_face.ts +98 -99
  247. package/src/renderer/cat/constants.ts +67 -87
  248. package/src/renderer/cat/drawer.ts +21 -27
  249. package/src/renderer/cat/path_object.ts +3 -5
  250. package/src/renderer/cat/render_info.ts +5 -8
  251. package/src/renderer/cat/renderer.ts +12 -16
  252. package/src/renderer/constants.ts +34 -49
  253. package/src/renderer/drawer.ts +35 -51
  254. package/src/renderer/path_object.ts +4 -10
  255. package/src/renderer/render_info.ts +39 -56
  256. package/src/renderer/renderer.ts +17 -30
  257. package/src/scratch_block_paster.ts +12 -20
  258. package/src/scratch_blocks_utils.ts +4 -7
  259. package/src/scratch_comment_bubble.ts +76 -105
  260. package/src/scratch_comment_icon.ts +75 -124
  261. package/src/scratch_connection_checker.ts +7 -17
  262. package/src/scratch_continuous_category.ts +24 -28
  263. package/src/scratch_continuous_toolbox.ts +20 -27
  264. package/src/scratch_dragger.ts +42 -81
  265. package/src/scratch_insertion_marker_previewer.ts +6 -11
  266. package/src/scratch_variable_map.ts +5 -12
  267. package/src/scratch_variable_model.ts +6 -13
  268. package/src/scratch_zoom_controls.ts +101 -156
  269. package/src/shadows.ts +32 -37
  270. package/src/status_indicator_label.ts +54 -67
  271. package/src/status_indicator_label_flyout_inflater.ts +11 -21
  272. package/src/variables.ts +92 -141
  273. package/src/xml.ts +21 -35
  274. package/tsconfig.json +3 -7
  275. package/types/continuous-toolbox.d.ts +1 -1
  276. package/dist/main.mjs.LICENSE.txt +0 -163
@@ -1,11 +1,9 @@
1
1
  /**
2
- * @license
3
2
  * Copyright 2024 Google LLC
4
3
  * SPDX-License-Identifier: Apache-2.0
5
4
  */
6
-
7
- import * as Blockly from "blockly/core";
8
- import type { ScratchCommentIcon } from "./scratch_comment_icon";
5
+ import * as Blockly from 'blockly/core'
6
+ import type { ScratchCommentIcon } from './scratch_comment_icon'
9
7
 
10
8
  /**
11
9
  * Class responsible for handling the pasting of copied blocks.
@@ -13,35 +11,32 @@ import type { ScratchCommentIcon } from "./scratch_comment_icon";
13
11
  class ScratchBlockPaster extends Blockly.clipboard.BlockPaster {
14
12
  /**
15
13
  * Deserializes the given block data onto the workspace.
16
- *
17
14
  * @param copyData The serialized block state to create a copy of on the
18
15
  * workspace.
19
16
  * @param workspace The workspace to paste the block onto.
20
17
  * @param coordinate The location to paste the block.
18
+ * @returns The newly pasted block, or undefined if pasting failed.
21
19
  */
22
20
  paste(
23
21
  copyData: Blockly.clipboard.BlockCopyData,
24
22
  workspace: Blockly.WorkspaceSvg,
25
- coordinate: Blockly.utils.Coordinate
23
+ coordinate: Blockly.utils.Coordinate,
26
24
  ) {
27
- const block = super.paste(copyData, workspace, coordinate);
28
- if (
29
- block?.type === "argument_reporter_boolean" ||
30
- block?.type === "argument_reporter_string_number"
31
- ) {
32
- block.setDragStrategy(new Blockly.dragging.BlockDragStrategy(block));
25
+ const block = super.paste(copyData, workspace, coordinate)
26
+ if (block?.type === 'argument_reporter_boolean' || block?.type === 'argument_reporter_string_number') {
27
+ block.setDragStrategy(new Blockly.dragging.BlockDragStrategy(block))
33
28
  }
34
29
 
35
30
  // Deserialization of blocks suppresses events, so even though this gets
36
31
  // fired for blocks with comments, the VM will never receive it, causing its
37
32
  // state to get out of sync. Manually fire it here (after suppression has
38
33
  // been turned off) if needed.
39
- const commentIcon = block.getIcon(Blockly.icons.IconType.COMMENT);
34
+ const commentIcon = block?.getIcon(Blockly.icons.IconType.COMMENT)
40
35
  if (commentIcon) {
41
- (commentIcon as ScratchCommentIcon).fireCreateEvent();
36
+ ;(commentIcon as ScratchCommentIcon).fireCreateEvent()
42
37
  }
43
38
 
44
- return block;
39
+ return block
45
40
  }
46
41
  }
47
42
 
@@ -50,9 +45,6 @@ class ScratchBlockPaster extends Blockly.clipboard.BlockPaster {
50
45
  * place.
51
46
  */
52
47
  export function registerScratchBlockPaster() {
53
- Blockly.clipboard.registry.unregister(ScratchBlockPaster.TYPE);
54
- Blockly.clipboard.registry.register(
55
- ScratchBlockPaster.TYPE,
56
- new ScratchBlockPaster()
57
- );
48
+ Blockly.clipboard.registry.unregister(ScratchBlockPaster.TYPE)
49
+ Blockly.clipboard.registry.register(ScratchBlockPaster.TYPE, new ScratchBlockPaster())
58
50
  }
@@ -1,5 +1,4 @@
1
1
  /**
2
- * @license
3
2
  * Visual Blocks Editor
4
3
  *
5
4
  * Copyright 2018 Google Inc.
@@ -17,23 +16,21 @@
17
16
  * See the License for the specific language governing permissions and
18
17
  * limitations under the License.
19
18
  */
20
-
21
19
  /**
22
- * @fileoverview Utility methods for Scratch Blocks but not Blockly.
20
+ * @file Utility methods for Scratch Blocks but not Blockly.
23
21
  * @author fenichel@google.com (Rachel Fenichel)
24
22
  */
25
- import * as Blockly from "blockly/core";
23
+ import * as Blockly from 'blockly/core'
26
24
 
27
25
  /**
28
26
  * Compare strings with natural number sorting.
29
- *
30
27
  * @param str1 First input.
31
28
  * @param str2 Second input.
32
29
  * @returns -1, 0, or 1 to signify greater than, equality, or less than.
33
30
  */
34
31
  export function compareStrings(str1: string, str2: string): number {
35
32
  return str1.localeCompare(str2, [], {
36
- sensitivity: "base",
33
+ sensitivity: 'base',
37
34
  numeric: true,
38
- });
35
+ })
39
36
  }
@@ -1,54 +1,37 @@
1
1
  /**
2
- * @license
3
2
  * Copyright 2024 Google LLC
4
3
  * SPDX-License-Identifier: Apache-2.0
5
4
  */
6
-
7
- import * as Blockly from "blockly/core";
5
+ import * as Blockly from 'blockly/core'
8
6
 
9
7
  /**
10
8
  * A Scratch-style comment bubble for block comments.
11
- * @implements {IBubble}
12
- * @implements {ISelectable}
13
9
  */
14
10
  export class ScratchCommentBubble
15
11
  extends Blockly.comments.CommentView
16
12
  implements Blockly.IBubble, Blockly.ISelectable
17
13
  {
18
- id: string;
19
- private sourceBlock: Blockly.BlockSvg;
20
- private anchor?: Blockly.utils.Coordinate;
21
- private anchorChain?: SVGLineElement;
22
- private dragStartLocation?: Blockly.utils.Coordinate;
14
+ id: string
15
+ private sourceBlock: Blockly.BlockSvg | null
16
+ private anchor?: Blockly.utils.Coordinate
17
+ private anchorChain?: SVGLineElement
18
+ private dragStartLocation?: Blockly.utils.Coordinate
23
19
 
24
20
  constructor(sourceBlock: Blockly.BlockSvg) {
25
- const commentId = `${sourceBlock.id}_comment`;
26
- super(sourceBlock.workspace, commentId);
27
- this.sourceBlock = sourceBlock;
28
- this.disposing = false;
29
- this.id = commentId;
30
- this.setPlaceholderText(Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT);
31
- this.getSvgRoot().setAttribute(
32
- "style",
33
- `--colour-commentBorder: ${sourceBlock.getColourTertiary()};`
34
- );
35
- this.getSvgRoot().setAttribute("id", this.id);
36
-
37
- Blockly.browserEvents.conditionalBind(
38
- this.getSvgRoot(),
39
- "pointerdown",
40
- this,
41
- this.startGesture
42
- );
21
+ const commentId = `${sourceBlock.id}_comment`
22
+ super(sourceBlock.workspace, commentId)
23
+ this.sourceBlock = sourceBlock
24
+ this.disposing = false
25
+ this.id = commentId
26
+ this.setPlaceholderText(Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT)
27
+ this.getSvgRoot().setAttribute('style', `--colour-commentBorder: ${sourceBlock.getColourTertiary()};`)
28
+ this.getSvgRoot().setAttribute('id', this.id)
29
+
30
+ Blockly.browserEvents.conditionalBind(this.getSvgRoot(), 'pointerdown', this, this.startGesture)
43
31
  // Don't zoom with mousewheel; let it scroll instead.
44
- Blockly.browserEvents.conditionalBind(
45
- this.getSvgRoot(),
46
- "wheel",
47
- this,
48
- (e: WheelEvent) => {
49
- e.stopPropagation();
50
- }
51
- );
32
+ Blockly.browserEvents.conditionalBind(this.getSvgRoot(), 'wheel', this, (e: WheelEvent) => {
33
+ e.stopPropagation()
34
+ })
52
35
  }
53
36
 
54
37
  setDeleteStyle(enable: boolean) {}
@@ -58,138 +41,126 @@ export class ScratchCommentBubble
58
41
  unselect() {}
59
42
 
60
43
  isMovable() {
61
- return true;
44
+ return true
62
45
  }
63
46
 
64
47
  moveDuringDrag(newLocation: Blockly.utils.Coordinate) {
65
- this.moveTo(newLocation);
48
+ this.moveTo(newLocation)
66
49
  }
67
50
 
68
- moveTo(xOrCoordinate: number, y: number): void;
69
- moveTo(xOrCoordinate: Blockly.utils.Coordinate): void;
51
+ moveTo(xOrCoordinate: number, y: number): void
52
+ moveTo(xOrCoordinate: Blockly.utils.Coordinate): void
70
53
  moveTo(xOrCoordinate: Blockly.utils.Coordinate | number, y?: number) {
71
54
  const destination =
72
55
  xOrCoordinate instanceof Blockly.utils.Coordinate
73
56
  ? xOrCoordinate
74
- : new Blockly.utils.Coordinate(xOrCoordinate, y);
75
- super.moveTo(destination);
76
- this.redrawAnchorChain();
57
+ : new Blockly.utils.Coordinate(xOrCoordinate, y!)
58
+ super.moveTo(destination)
59
+ this.redrawAnchorChain()
77
60
  }
78
61
 
79
62
  startGesture(e: PointerEvent) {
80
- const gesture = this.workspace.getGesture(e);
63
+ const gesture = this.workspace.getGesture(e)
81
64
  if (gesture) {
82
- gesture.handleBubbleStart(e, this);
83
- Blockly.common.setSelected(this);
65
+ // ScratchCommentBubble implements IBubble structurally but TypeScript
66
+ // cannot verify it because IBubble.drag has a different signature here.
67
+ gesture.handleBubbleStart(e, this as unknown as Blockly.IBubble)
68
+ Blockly.common.setSelected(this)
84
69
  }
85
70
  }
86
71
 
87
72
  startDrag(event: PointerEvent) {
88
- this.dragStartLocation = this.getRelativeToSurfaceXY();
89
- this.workspace.setResizesEnabled(false);
90
- this.workspace.getLayerManager()?.moveToDragLayer(this);
91
- Blockly.utils.dom.addClass(this.getSvgRoot(), "blocklyDragging");
73
+ this.dragStartLocation = this.getRelativeToSurfaceXY()
74
+ this.workspace.setResizesEnabled(false)
75
+ this.workspace.getLayerManager()?.moveToDragLayer(this)
76
+ Blockly.utils.dom.addClass(this.getSvgRoot(), 'blocklyDragging')
92
77
  }
93
78
 
94
- drag(newLocation: Blockly.utils.Coordinate, event: Event) {
95
- this.moveTo(newLocation);
79
+ drag(newLocation: Blockly.utils.Coordinate, event?: PointerEvent) {
80
+ this.moveTo(newLocation)
96
81
  }
97
82
 
98
83
  endDrag() {
99
- this.workspace
100
- .getLayerManager()
101
- ?.moveOffDragLayer(this, Blockly.layers.BUBBLE);
102
- this.workspace.setResizesEnabled(false);
103
- Blockly.utils.dom.removeClass(this.getSvgRoot(), "blocklyDragging");
84
+ this.workspace.getLayerManager()?.moveOffDragLayer(this, Blockly.layers.BUBBLE)
85
+ this.workspace.setResizesEnabled(false)
86
+ Blockly.utils.dom.removeClass(this.getSvgRoot(), 'blocklyDragging')
104
87
  Blockly.Events.fire(
105
- new (Blockly.Events.get("block_comment_move"))(
106
- this,
107
- this.dragStartLocation,
108
- this.getRelativeToSurfaceXY()
109
- )
110
- );
88
+ new (Blockly.Events.get('block_comment_move'))(this, this.dragStartLocation, this.getRelativeToSurfaceXY()),
89
+ )
111
90
  }
112
91
 
113
92
  revertDrag() {
114
- this.moveTo(this.dragStartLocation);
93
+ this.moveTo(this.dragStartLocation!)
115
94
  }
116
95
 
117
96
  setAnchorLocation(newAnchor: Blockly.utils.Coordinate) {
118
- const oldAnchor = this.anchor;
119
- const alreadyAnchored = !!this.anchor;
120
- this.anchor = newAnchor;
97
+ const oldAnchor = this.anchor
98
+ const alreadyAnchored = !!this.anchor
99
+ this.anchor = newAnchor
121
100
  if (!alreadyAnchored) {
122
- this.dropAnchor();
101
+ this.dropAnchor()
123
102
  } else {
124
- const oldLocation = this.getRelativeToSurfaceXY();
125
- const delta = Blockly.utils.Coordinate.difference(this.anchor, oldAnchor);
126
- const newLocation = Blockly.utils.Coordinate.sum(oldLocation, delta);
127
- this.moveTo(newLocation);
103
+ const oldLocation = this.getRelativeToSurfaceXY()
104
+ const delta = Blockly.utils.Coordinate.difference(this.anchor, oldAnchor!)
105
+ const newLocation = Blockly.utils.Coordinate.sum(oldLocation, delta)
106
+ this.moveTo(newLocation)
128
107
  }
129
108
  }
130
109
 
131
110
  dropAnchor() {
132
- const verticalOffset = 16;
133
- this.moveTo(
134
- this.anchor.x + 40 * (this.workspace.RTL ? -1 : 1),
135
- this.anchor.y - verticalOffset
136
- );
137
- const location = this.getRelativeToSurfaceXY();
111
+ const verticalOffset = 16
112
+ this.moveTo(this.anchor!.x + 40 * (this.workspace.RTL ? -1 : 1), this.anchor!.y - verticalOffset)
113
+ const location = this.getRelativeToSurfaceXY()
138
114
  this.anchorChain = Blockly.utils.dom.createSvgElement(
139
115
  Blockly.utils.Svg.LINE,
140
116
  {
141
- x1: this.anchor.x - location.x,
142
- y1: this.anchor.y - location.y,
117
+ x1: this.anchor!.x - location.x,
118
+ y1: this.anchor!.y - location.y,
143
119
  x2: (this.getSize().width / 2) * (this.workspace.RTL ? -1 : 1),
144
120
  y2: verticalOffset,
145
- style: `stroke: ${this.sourceBlock.getColourTertiary()}; stroke-width: 1`,
121
+ style: `stroke: ${this.sourceBlock!.getColourTertiary()}; stroke-width: 1`,
146
122
  },
147
- this.getSvgRoot()
148
- );
149
- this.getSvgRoot().insertBefore(
150
- this.anchorChain,
151
- this.getSvgRoot().firstChild
152
- );
123
+ this.getSvgRoot(),
124
+ )
125
+ this.getSvgRoot().insertBefore(this.anchorChain, this.getSvgRoot().firstChild)
153
126
  }
154
127
 
155
128
  redrawAnchorChain() {
156
- if (!this.anchorChain) return;
129
+ if (!this.anchorChain) return
157
130
 
158
- const location = this.getRelativeToSurfaceXY();
159
- this.anchorChain.setAttribute("x1", `${this.anchor.x - location.x}`);
160
- this.anchorChain.setAttribute("y1", `${this.anchor.y - location.y}`);
131
+ const location = this.getRelativeToSurfaceXY()
132
+ this.anchorChain.setAttribute('x1', `${this.anchor!.x - location.x}`)
133
+ this.anchorChain.setAttribute('y1', `${this.anchor!.y - location.y}`)
161
134
  }
162
135
 
163
136
  getId() {
164
- return this.id;
137
+ return this.id
165
138
  }
166
139
 
167
140
  getSourceBlock() {
168
- return this.sourceBlock;
141
+ return this.sourceBlock
169
142
  }
170
143
 
171
144
  dispose() {
172
- this.disposing = true;
173
- Blockly.utils.dom.removeNode(this.anchorChain);
145
+ this.disposing = true
146
+ Blockly.utils.dom.removeNode(this.anchorChain ?? null)
174
147
  if (this.sourceBlock) {
175
- Blockly.Events.fire(
176
- new (Blockly.Events.get("block_comment_delete"))(this, this.sourceBlock)
177
- );
178
- const block = this.sourceBlock;
179
- this.sourceBlock = null;
148
+ Blockly.Events.fire(new (Blockly.Events.get('block_comment_delete'))(this, this.sourceBlock))
149
+ const block = this.sourceBlock
150
+ this.sourceBlock = null
180
151
  if (!block.isDeadOrDying()) {
181
- block.setCommentText(null);
152
+ block.setCommentText(null)
182
153
  }
183
154
  }
184
- super.dispose();
155
+ super.dispose()
185
156
  }
186
157
 
187
158
  getFocusableElement() {
188
- return this.getSvgRoot();
159
+ return this.getSvgRoot()
189
160
  }
190
161
 
191
162
  getFocusableTree() {
192
- return this.workspace;
163
+ return this.workspace
193
164
  }
194
165
 
195
166
  onNodeFocus() {}
@@ -197,6 +168,6 @@ export class ScratchCommentBubble
197
168
  onNodeBlur() {}
198
169
 
199
170
  canBeFocused() {
200
- return true;
171
+ return true
201
172
  }
202
173
  }
@@ -1,169 +1,125 @@
1
1
  /**
2
- * @license
3
2
  * Copyright 2024 Google LLC
4
3
  * SPDX-License-Identifier: Apache-2.0
5
4
  */
6
-
7
- import * as Blockly from "blockly/core";
8
- import { ScratchCommentBubble } from "./scratch_comment_bubble";
5
+ import * as Blockly from 'blockly/core'
6
+ import { ScratchCommentBubble } from './scratch_comment_bubble'
9
7
 
10
8
  interface CommentState {
11
- text: string;
12
- height: number;
13
- width: number;
14
- x: number;
15
- y: number;
16
- collapsed: boolean;
9
+ text: string
10
+ height: number
11
+ width: number
12
+ x: number
13
+ y: number
14
+ collapsed: boolean
17
15
  }
18
16
 
19
17
  /**
20
18
  * Custom comment icon that draws no icon indicator, used for block comments.
21
19
  */
22
- export class ScratchCommentIcon
23
- extends Blockly.icons.Icon
24
- implements Blockly.ISerializable, Blockly.IHasBubble
25
- {
26
- private commentBubble: ScratchCommentBubble;
27
- private onTextChangedListener: (oldText: string, newText: string) => void;
28
- private onSizeChangedListener: (
29
- oldSize: Blockly.utils.Size,
30
- newSize: Blockly.utils.Size
31
- ) => void;
32
- private onCollapseListener: (collapsed: boolean) => void;
20
+ export class ScratchCommentIcon extends Blockly.icons.Icon implements Blockly.ISerializable, Blockly.IHasBubble {
21
+ private commentBubble: ScratchCommentBubble
22
+ private onTextChangedListener: (oldText: string, newText: string) => void
23
+ private onSizeChangedListener: (oldSize: Blockly.utils.Size, newSize: Blockly.utils.Size) => void
24
+ private onCollapseListener: (collapsed: boolean) => void
33
25
 
34
26
  constructor(protected sourceBlock: Blockly.BlockSvg) {
35
- super(sourceBlock);
36
- this.commentBubble = new ScratchCommentBubble(this.sourceBlock);
37
- this.fireCreateEvent();
38
- this.onTextChangedListener = this.onTextChanged.bind(this);
39
- this.onSizeChangedListener = this.onSizeChanged.bind(this);
40
- this.onCollapseListener = this.onCollapsed.bind(this);
41
- this.commentBubble.addTextChangeListener(this.onTextChangedListener);
42
- this.commentBubble.addSizeChangeListener(this.onSizeChangedListener);
43
- this.commentBubble.addOnCollapseListener(this.onCollapseListener);
27
+ super(sourceBlock)
28
+ this.commentBubble = new ScratchCommentBubble(this.sourceBlock)
29
+ this.fireCreateEvent()
30
+ this.onTextChangedListener = this.onTextChanged.bind(this)
31
+ this.onSizeChangedListener = this.onSizeChanged.bind(this)
32
+ this.onCollapseListener = this.onCollapsed.bind(this)
33
+ this.commentBubble.addTextChangeListener(this.onTextChangedListener)
34
+ this.commentBubble.addSizeChangeListener(this.onSizeChangedListener)
35
+ this.commentBubble.addOnCollapseListener(this.onCollapseListener)
44
36
  }
45
37
 
46
38
  getType(): Blockly.icons.IconType<ScratchCommentIcon> {
47
- return Blockly.icons.IconType.COMMENT;
39
+ return Blockly.icons.IconType.COMMENT
48
40
  }
49
41
 
50
42
  initView(pointerDownListener: (e: PointerEvent) => void) {
51
43
  // Scratch comments have no indicator icon on the block.
52
- return;
44
+ return
53
45
  }
54
46
 
55
47
  getSize(): Blockly.utils.Size {
56
48
  // Awful hack to cancel out the default padding added to icons.
57
- return new Blockly.utils.Size(-8, 0);
49
+ return new Blockly.utils.Size(-8, 0)
58
50
  }
59
51
 
60
52
  getAnchorPoint(): Blockly.utils.Coordinate {
61
- const blockRect = this.sourceBlock.getBoundingRectangleWithoutChildren();
62
- const y = blockRect.top + this.offsetInBlock.y;
63
- const x = this.sourceBlock.workspace.RTL ? blockRect.left : blockRect.right;
64
- return new Blockly.utils.Coordinate(x, y);
53
+ const blockRect = this.sourceBlock.getBoundingRectangleWithoutChildren()
54
+ const y = blockRect.top + this.offsetInBlock.y
55
+ const x = this.sourceBlock.workspace.RTL ? blockRect.left : blockRect.right
56
+ return new Blockly.utils.Coordinate(x, y)
65
57
  }
66
58
 
67
59
  onLocationChange(blockOrigin: Blockly.utils.Coordinate) {
68
- if (!this.sourceBlock || !this.commentBubble) return;
60
+ if (!this.sourceBlock || !this.commentBubble) return
69
61
 
70
62
  if (this.sourceBlock.isInsertionMarker()) {
71
- this.commentBubble.dispose();
72
- return;
63
+ this.commentBubble.dispose()
64
+ return
73
65
  }
74
66
 
75
- super.onLocationChange(blockOrigin);
76
- const oldBubbleLocation = this.commentBubble.getRelativeToSurfaceXY();
77
- this.commentBubble.setAnchorLocation(this.getAnchorPoint());
78
- const newBubbleLocation = this.commentBubble.getRelativeToSurfaceXY();
67
+ super.onLocationChange(blockOrigin)
68
+ const oldBubbleLocation = this.commentBubble.getRelativeToSurfaceXY()
69
+ this.commentBubble.setAnchorLocation(this.getAnchorPoint())
70
+ const newBubbleLocation = this.commentBubble.getRelativeToSurfaceXY()
79
71
  Blockly.Events.fire(
80
- new (Blockly.Events.get("block_comment_move"))(
81
- this.commentBubble,
82
- oldBubbleLocation,
83
- newBubbleLocation
84
- )
85
- );
72
+ new (Blockly.Events.get('block_comment_move'))(this.commentBubble, oldBubbleLocation, newBubbleLocation),
73
+ )
86
74
  }
87
75
 
88
76
  setText(text: string) {
89
- this.commentBubble?.setText(text);
77
+ this.commentBubble?.setText(text)
90
78
  }
91
79
 
92
80
  getText(): string {
93
- return this.commentBubble?.getText() ?? "";
81
+ return this.commentBubble?.getText() ?? ''
94
82
  }
95
83
 
96
84
  onTextChanged(oldText: string, newText: string) {
97
85
  Blockly.Events.fire(
98
- new (Blockly.Events.get(Blockly.Events.BLOCK_CHANGE))(
99
- this.sourceBlock,
100
- "comment",
101
- null,
102
- oldText,
103
- newText
104
- )
105
- );
106
- Blockly.Events.fire(
107
- new (Blockly.Events.get("block_comment_change"))(
108
- this.commentBubble,
109
- oldText,
110
- newText
111
- )
112
- );
86
+ new (Blockly.Events.get(Blockly.Events.BLOCK_CHANGE))(this.sourceBlock, 'comment', null, oldText, newText),
87
+ )
88
+ Blockly.Events.fire(new (Blockly.Events.get('block_comment_change'))(this.commentBubble, oldText, newText))
113
89
  }
114
90
 
115
91
  onCollapsed(collapsed: boolean) {
116
- Blockly.Events.fire(
117
- new (Blockly.Events.get("block_comment_collapse"))(
118
- this.commentBubble,
119
- collapsed
120
- )
121
- );
92
+ Blockly.Events.fire(new (Blockly.Events.get('block_comment_collapse'))(this.commentBubble, collapsed))
122
93
  }
123
94
 
124
95
  onSizeChanged(oldSize: Blockly.utils.Size, newSize: Blockly.utils.Size) {
125
- Blockly.Events.fire(
126
- new (Blockly.Events.get("block_comment_resize"))(
127
- this.commentBubble,
128
- oldSize,
129
- newSize
130
- )
131
- );
96
+ Blockly.Events.fire(new (Blockly.Events.get('block_comment_resize'))(this.commentBubble, oldSize, newSize))
132
97
  }
133
98
 
134
99
  setBubbleSize(size: Blockly.utils.Size) {
135
- this.commentBubble?.setSize(size);
100
+ this.commentBubble?.setSize(size)
136
101
  }
137
102
 
138
103
  getBubbleSize(): Blockly.utils.Size {
139
- return this.commentBubble?.getSize() ?? new Blockly.utils.Size(0, 0);
104
+ return this.commentBubble?.getSize() ?? new Blockly.utils.Size(0, 0)
140
105
  }
141
106
 
142
107
  setBubbleLocation(newLocation: Blockly.utils.Coordinate) {
143
- const oldLocation = this.getBubbleLocation();
144
- this.commentBubble?.moveTo(newLocation);
145
- Blockly.Events.fire(
146
- new (Blockly.Events.get("block_comment_move"))(
147
- this.commentBubble,
148
- oldLocation,
149
- newLocation
150
- )
151
- );
108
+ const oldLocation = this.getBubbleLocation()
109
+ this.commentBubble?.moveTo(newLocation)
110
+ Blockly.Events.fire(new (Blockly.Events.get('block_comment_move'))(this.commentBubble, oldLocation, newLocation))
152
111
  }
153
112
 
154
113
  getBubbleLocation(): Blockly.utils.Coordinate {
155
- return this.commentBubble?.getRelativeToSurfaceXY();
114
+ return this.commentBubble?.getRelativeToSurfaceXY()
156
115
  }
157
116
 
158
117
  saveState(): CommentState | null {
159
- if (!this.commentBubble) return null;
160
-
161
- const size = this.getBubbleSize();
162
- const bubbleLocation = this.commentBubble.getRelativeToSurfaceXY();
163
- const delta = Blockly.utils.Coordinate.difference(
164
- bubbleLocation,
165
- this.workspaceLocation
166
- );
118
+ if (!this.commentBubble) return null
119
+
120
+ const size = this.getBubbleSize()
121
+ const bubbleLocation = this.commentBubble.getRelativeToSurfaceXY()
122
+ const delta = Blockly.utils.Coordinate.difference(bubbleLocation, this.workspaceLocation)
167
123
  return {
168
124
  text: this.getText(),
169
125
  height: size.height,
@@ -171,51 +127,46 @@ export class ScratchCommentIcon
171
127
  x: delta.x,
172
128
  y: delta.y,
173
129
  collapsed: this.commentBubble.isCollapsed(),
174
- };
130
+ }
175
131
  }
176
132
 
177
133
  loadState(state: CommentState) {
178
- Blockly.Events.setGroup(true);
179
- this.setText(state["text"]);
180
- this.setBubbleSize(new Blockly.utils.Size(state["width"], state["height"]));
181
- const delta = new Blockly.utils.Coordinate(state["x"], state["y"]);
182
- const newBubbleLocation = Blockly.utils.Coordinate.sum(
183
- this.workspaceLocation,
184
- delta
185
- );
186
- this.commentBubble.moveTo(newBubbleLocation);
187
- this.commentBubble.setCollapsed(state["collapsed"]);
188
- Blockly.Events.setGroup(false);
134
+ Blockly.Events.setGroup(true)
135
+ this.setText(state.text)
136
+ this.setBubbleSize(new Blockly.utils.Size(state.width, state.height))
137
+ const delta = new Blockly.utils.Coordinate(state.x, state.y)
138
+ const newBubbleLocation = Blockly.utils.Coordinate.sum(this.workspaceLocation, delta)
139
+ this.commentBubble.moveTo(newBubbleLocation)
140
+ this.commentBubble.setCollapsed(state.collapsed)
141
+ Blockly.Events.setGroup(false)
189
142
  }
190
143
 
191
144
  bubbleIsVisible(): boolean {
192
- return true;
145
+ return true
193
146
  }
194
147
 
195
148
  async setBubbleVisible(visible: boolean) {
196
- this.commentBubble.setCollapsed(!visible);
149
+ this.commentBubble.setCollapsed(!visible)
197
150
  }
198
151
 
199
- getBubble() {
200
- return this.commentBubble;
152
+ getBubble(): ScratchCommentBubble | null {
153
+ return this.commentBubble
201
154
  }
202
155
 
203
156
  dispose() {
204
- this.commentBubble.dispose();
205
- super.dispose();
157
+ this.commentBubble.dispose()
158
+ super.dispose()
206
159
  }
207
160
 
208
161
  canBeFocused() {
209
- return false;
162
+ return false
210
163
  }
211
164
 
212
165
  /**
213
166
  * Fires a block comment create event corresponding to this icon's comment.
214
167
  */
215
168
  fireCreateEvent() {
216
- Blockly.Events.fire(
217
- new (Blockly.Events.get("block_comment_create"))(this.commentBubble)
218
- );
169
+ Blockly.Events.fire(new (Blockly.Events.get('block_comment_create'))(this.commentBubble))
219
170
  }
220
171
  }
221
172
 
@@ -223,5 +174,5 @@ Blockly.registry.register(
223
174
  Blockly.registry.Type.ICON,
224
175
  Blockly.icons.IconType.COMMENT.toString(),
225
176
  ScratchCommentIcon,
226
- true
227
- );
177
+ true,
178
+ )