Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add custom context menu rendering #7409

Merged

Conversation

BeksOmega
Copy link
Collaborator

The basics

The details

Resolves

Fixes #6406

Proposed Changes

Fixes the types on context menu items so that you can pass your own HTML elements. The context menu already supports this, we were just restricting it with our documented types.

Reason for Changes

Peoples want to be able to add their own icons and whatnot to the context menu! This enables them to do so.

Test Coverage

Manually tested by changing the displayText() method on the duplicate option to the following:

    displayText() {
      const elem = document.createElement('span');
      elem.appendChild(document.createTextNode('test'));
      elem.style.fontWeight = 'bold';
      return elem;
    },

image

Documentation

https://developers.google.com/blockly/guides/configure/web/context-menus should be updated.

Additional Information

I looked into whether we need to do anything to support people using our CSS classes, but they're all applied to a wrapper object that the text/html element gets appended to, so I don't think there's anything we need to surface.

@BeksOmega BeksOmega requested a review from a team as a code owner August 17, 2023 21:32
@github-actions github-actions bot added the PR: feature Adds a feature label Aug 17, 2023
@BeksOmega BeksOmega merged commit cb0f703 into google:develop Aug 17, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: feature Adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Context Menu Rendering Customization
2 participants