api.menu
MenuApi
Items in the editor's menu bar. A path whose last segment names no submenu makes one.
Members
add
add(path: MenuPath, item: MenuItemSpec): Disposable;
Add an item to the editor's menu bar.
api.menu.add("Tools", {
label: "Count units…",
icon: "plugin",
enabled: () => api.document.isOpen(),
run: () => api.ui.alert(`Player 1 has ${api.query.unitsOf(0).length} units.`),
});Try it// A path whose last segment names no submenu makes one, at the end of that menu.
api.menu.add("Tools/My plugin", { label: "About…", run: () => api.ui.alert(`${api.plugin.name} ${api.plugin.version ?? ""}`) });
// `after` puts an item directly under a built-in one, named by its English label.
api.menu.add("File", { label: "Open from My Site…", after: "Open Recent", run: () => api.ui.status("…") });Try itTypes
Declarations only this group names.