Skip to content

EditorCommandHandler.shouldAddCommandToSubmenu method

EditorCommandHandler › shouldAddCommandToSubmenu

Gets whether to add the command to a submenu.

The registration context wins over the constructor value: a menu surface that already wraps every contributed item in a plugin-titled parent entry forces this off, because a section submenu declared here would make Menu.sort() nest a second plugin-titled entry inside the first.

Next come the user's command switches, when the settings tab component attached them, then the constructor value. When none of those sets a value, getDefaultShouldAddCommandToSubmenu decides. Override that hook, not this method, to supply a fallback such as a plugin setting, so a registration that forces the flag off still wins.

Signature:

shouldAddCommandToSubmenu(): boolean

Returns: boolean — Whether to add to a submenu.