feat: add custom context menu rendering #7409
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: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.