-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
issue: feature requestDescribes a new feature and why it should be addedDescribes a new feature and why it should be added
Description
Check for duplicates
- I have searched for similar issues before opening a new one.
Problem
Context menus can currently only be opened on blocks, workspaces, and workspace comments. It must be possible to open them on any focusable item that wants to show them, such as connections.
We'll deprecate the scopeType property. Instead, context menu items will be responsible for setting their own scopes through the preconditionFn. For example, the "Delete Block" menu item should only appear if the focused item is a block. The precondition for this menu item will return 'hidden' if the scope.focusedNode is not a Block.
Request
- Make the
scopeTypeproperty in theContextMenuItemtype optional. - Add backwards-compatibility for existing context menu items:
- At registration time, if a menu item is registered that passes in a
scopeTypeproperty, wrap the suppliedpreconditionFnin a function that returnshiddenif thescopedoes not match thescopeType. - Add tests to make sure backwards-compatibility is intact.
- At registration time, if a menu item is registered that passes in a
- Update the existing context menu items to have appropriate preconditionFns.
- Remove the checks based on
scopeTypefrom thegetContextMenuOptionsfunction in the registry. All registered items will have their preconditions checked.
Alternatives considered
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
issue: feature requestDescribes a new feature and why it should be addedDescribes a new feature and why it should be added