blockly > ContextMenuRegistry > getContextMenuOptions
Ruft die gültigen Kontextmenüoptionen für den angegebenen Bereichstyp (z.B. Block oder Arbeitsbereich) und Bereich ab. Blockierungen werden nur angezeigt, wenn unter „preconditionFn“ angegeben ist, dass sie nicht ausgeblendet werden sollen.
Unterschrift:
getContextMenuOptions(scopeType: ScopeType, scope: Scope): ContextMenuOption[];
Parameter
Parameter |
Typ |
Beschreibung |
scopeType |
ScopeType |
Art des Geltungsbereichs, in dem das Menü angezeigt werden soll (z.B. auf einem Block oder in einem Arbeitsbereich) |
Bereich |
Umfang |
Aktueller Umfang des Kontextmenüs (d. h. der exakte Arbeitsbereich oder Block, auf den bzw. der geklickt wird) |
Gibt zurück:
ContextMenuOption[]
die Liste der ContextMenuOptions
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2024-09-12 (UTC).
[null,null,["Zuletzt aktualisiert: 2024-09-12 (UTC)."],[[["Retrieves context menu options relevant to the provided scope type and current scope, such as a workspace or block."],["Options for blocks are displayed based on a precondition function that determines their visibility."],["The function requires the scope type and the specific scope as input."],["It returns an array of `ContextMenuOption` objects representing the available menu choices."]]],["The `getContextMenuOptions` method retrieves valid context menu options. It takes `scopeType` (e.g., block or workspace) and the current `scope` (specific workspace or block) as parameters. It returns a list of `ContextMenuOption` objects. Blocks are included only if a defined precondition function indicates they should be shown. This method determines what menu options are available based on where the context menu is being displayed.\n"]]