google/blockly

V11 advanced playground context menu is broken

Closed this issue · 3 comments

Check for duplicates

  • I have searched for similar issues before opening a new one.

Description

The advanced playground has a couple of errors which may be related to versions:

  • Colour category breaks when opening toolbox.
  • Right-clicking on the workspace generates: Uncaught TypeError: Blockly.ContextMenu.workspaceCommentOption is not a function

Reproduction steps

No response

Stack trace

No response

Screenshots

No response

Browsers

No response

Also the normal playground with test blocks, Fields > Validators fails to load. May be related due to field angle being missing.

Code for configuring the context menu in tests/playgrounds/advanced_playground.html:

      function configureContextMenu(menuOptions, e) {
        var workspace = this;
        var screenshotOption = {
          text: 'Download Screenshot',
          enabled: workspace.getTopBlocks().length,
          callback: function () {
            downloadScreenshot(workspace);
          },
        };
        menuOptions.push(screenshotOption);

        // Adds a default-sized workspace comment to the workspace.
        menuOptions.push(
          Blockly.ContextMenu.workspaceCommentOption(workspace, e),
        );
      }

There's a bad access on the last line: menuOptions.push(Blockly.ContextMenu.workspaceCommentOption(workspace, e));

Some of these issues are already noted here google/blockly-samples#2345 and have already been fixed.

But the context menu one is part of the configuration in core and does need to be fixed.