Stay organized with collections
Save and categorize content based on your preferences.
blockly > ContextMenuRegistry
Signature:
export declare namespace ContextMenuRegistry
Enumerations
Enumeration |
Description |
ScopeType |
Where this menu item should be rendered. If the menu item should be rendered in multiple scopes, e.g. on both a block and a workspace, it should be registered for each scope. |
Interfaces
Interface |
Description |
ActionContextMenuOption |
A representation of a normal, clickable menu item in contextmenu.ts. |
ActionRegistryItem |
A representation of a normal, clickable menu item in the registry. |
CoreContextMenuOption |
Fields common to all context menu items as used by contextmenu.ts. |
CoreRegistryItem |
Fields common to all context menu registry items. |
LegacyContextMenuOption |
A subset of ContextMenuOption corresponding to what was publicly documented. ContextMenuOption should be preferred for new code. |
Scope |
The actual workspace/block/focused object where the menu is being rendered. This is passed to callback and displayText functions that depend on this information. |
SeparatorContextMenuOption |
A representation of a menu separator item in contextmenu.ts. |
SeparatorRegistryItem |
A representation of a menu separator item in the registry. |
Type Aliases
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eContextMenuRegistry\u003c/code\u003e namespace manages the registration and display of context menu items within Blockly workspaces.\u003c/p\u003e\n"],["\u003cp\u003eIt defines enumerations like \u003ccode\u003eScopeType\u003c/code\u003e to determine where menu items should appear (e.g., block, workspace).\u003c/p\u003e\n"],["\u003cp\u003eInterfaces like \u003ccode\u003eContextMenuOption\u003c/code\u003e and \u003ccode\u003eRegistryItem\u003c/code\u003e standardize the structure of menu items for both internal use and external registration.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLegacyContextMenuOption\u003c/code\u003e provides compatibility with older code but using \u003ccode\u003eContextMenuOption\u003c/code\u003e is recommended for new implementations.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eScope\u003c/code\u003e interface provides context-specific information about the workspace or block where the menu is displayed.\u003c/p\u003e\n"]]],["The `ContextMenuRegistry` namespace manages context menu items in Blockly. It defines an enumeration `ScopeType` to specify where a menu item should appear. Four interfaces are provided: `ContextMenuOption` and `LegacyContextMenuOption` represent menu items for display. `RegistryItem` represents menu items within the registry, and `Scope` represents the rendering context, such as a workspace or block, providing context-dependent data. Developers should use `ContextMenuOption` when building new code.\n"],null,["[blockly](./blockly.md) \\\u003e [ContextMenuRegistry](./blockly.contextmenuregistry_namespace.md)\n\nContextMenuRegistry namespace\n-----------------------------\n\n**Signature:** \n\n export declare namespace ContextMenuRegistry \n\nEnumerations\n------------\n\n| Enumeration | Description |\n|------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [ScopeType](./blockly.contextmenuregistry_namespace.scopetype_enum.md) | Where this menu item should be rendered. If the menu item should be rendered in multiple scopes, e.g. on both a block and a workspace, it should be registered for each scope. |\n\nInterfaces\n----------\n\n| Interface | Description |\n|---------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [ActionContextMenuOption](./blockly.contextmenuregistry_namespace.actioncontextmenuoption_interface.md) | A representation of a normal, clickable menu item in contextmenu.ts. |\n| [ActionRegistryItem](./blockly.contextmenuregistry_namespace.actionregistryitem_interface.md) | A representation of a normal, clickable menu item in the registry. |\n| [CoreContextMenuOption](./blockly.contextmenuregistry_namespace.corecontextmenuoption_interface.md) | Fields common to all context menu items as used by contextmenu.ts. |\n| [CoreRegistryItem](./blockly.contextmenuregistry_namespace.coreregistryitem_interface.md) | Fields common to all context menu registry items. |\n| [LegacyContextMenuOption](./blockly.contextmenuregistry_namespace.legacycontextmenuoption_interface.md) | A subset of ContextMenuOption corresponding to what was publicly documented. ContextMenuOption should be preferred for new code. |\n| [Scope](./blockly.contextmenuregistry_namespace.scope_interface.md) | The actual workspace/block/focused object where the menu is being rendered. This is passed to callback and displayText functions that depend on this information. |\n| [SeparatorContextMenuOption](./blockly.contextmenuregistry_namespace.separatorcontextmenuoption_interface.md) | A representation of a menu separator item in contextmenu.ts. |\n| [SeparatorRegistryItem](./blockly.contextmenuregistry_namespace.separatorregistryitem_interface.md) | A representation of a menu separator item in the registry. |\n\nType Aliases\n------------\n\n| Type Alias | Description |\n|---------------------------------------------------------------------------------------------|---------------------------------------------|\n| [ContextMenuOption](./blockly.contextmenuregistry_namespace.contextmenuoption_typealias.md) | A menu item as presented to contextmenu.ts. |\n| [RegistryItem](./blockly.contextmenuregistry_namespace.registryitem_typealias.md) | A menu item as entered in the registry. |"]]