diff --git a/src/common/catalog/catalog-entity.ts b/src/common/catalog/catalog-entity.ts index e74fd238e3..5647f5b0d3 100644 --- a/src/common/catalog/catalog-entity.ts +++ b/src/common/catalog/catalog-entity.ts @@ -124,6 +124,7 @@ export interface CatalogEntityContextMenu { export interface CatalogEntityAddMenu extends CatalogEntityContextMenu { icon: string | React.ComponentType; + defaultAction?: boolean; } export interface CatalogEntitySettingsMenu { diff --git a/src/renderer/components/+catalog/catalog-add-button.tsx b/src/renderer/components/+catalog/catalog-add-button.tsx index 636b03b2f7..7282c53f82 100644 --- a/src/renderer/components/+catalog/catalog-add-button.tsx +++ b/src/renderer/components/+catalog/catalog-add-button.tsx @@ -73,9 +73,10 @@ export class CatalogAddButton extends React.Component { @boundMethod onButtonClick() { - if (this.menuItems.length == 1) { - this.menuItems[0].onClick(); - } + const defaultAction = this.menuItems.find(item => item.defaultAction)?.onClick; + const clickAction = defaultAction || this.menuItems.length == 1 ? this.menuItems[0].onClick : null; + + clickAction?.(); } render() {