Skip to content

Commit

Permalink
fix exception when double registering comment context menu items
Browse files Browse the repository at this point in the history
  • Loading branch information
riknoll committed Oct 9, 2024
1 parent 3fd4d2a commit f366be7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pxtblocks/contextMenu/contextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export function initContextMenu() {
}

export function setupWorkspaceContextMenu(workspace: Blockly.WorkspaceSvg) {
Blockly.ContextMenuItems.registerCommentOptions();
try {
Blockly.ContextMenuItems.registerCommentOptions();
}
catch (e) {
// will throw if already registered. ignore
}
workspace.configureContextMenu = (options, e) => {
if (workspace.options.comments && !workspace.options.readOnly) {
// options.unshift(Blockly.ContextMenu.workspaceCommentOption(workspace, e))

}

onWorkspaceContextMenu(workspace, options);
};
}

0 comments on commit f366be7

Please sign in to comment.