Skip to content

Commit 0285c10

Browse files
The keyboard nav plugin tweaks these actions (#17)
We'll review the sequence in MakeCode, but for now avoid exploding.
1 parent cc65ea6 commit 0285c10

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pxtblocks/contextMenu/blockItems.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,16 @@ export function registerBlockitems() {
2424
registerHelp();
2525

2626
// Fix the weights of the builtin options we do use
27-
Blockly.ContextMenuRegistry.registry.getItem("blockDelete").weight = BlockContextWeight.DeleteBlock;
28-
Blockly.ContextMenuRegistry.registry.getItem("blockComment").weight = BlockContextWeight.AddComment;
27+
// Defensiveness due to action changes in the keyboard navigation plugin.
28+
// Needs revisiting when actions are final.
29+
const blockDelete = Blockly.ContextMenuRegistry.registry.getItem("blockDelete");
30+
if (blockDelete) {
31+
blockDelete.weight = BlockContextWeight.DeleteBlock;
32+
}
33+
const blockComment = Blockly.ContextMenuRegistry.registry.getItem("blockComment");
34+
if (blockComment) {
35+
blockComment.weight = BlockContextWeight.AddComment;
36+
}
2937
}
3038

3139
/**

0 commit comments

Comments
 (0)