@@ -385,6 +387,40 @@ const ArchitectureComponentLibrary = ({
);
};
+const DiagramInsertMenu = ({
+ icon: TriggerIcon,
+ items,
+ label,
+}: {
+ icon: LucideIcon;
+ items: Array<{ icon: LucideIcon; label: string; onSelect: () => void }>;
+ label: string;
+}) => {
+ const [open, setOpen] = useState(false);
+ return (
+
+
+
+
+
+ {items.map((item) => {
+ const Icon = item.icon;
+ return (
+
+
+ {item.label}
+
+ );
+ })}
+
+
+ );
+};
+
const FLOW_ACTIVE_NODE_CLASS = "edgeever-flow-node-active";
const FLOW_PORT_HIT_RADIUS = 14;
const FLOW_PORT_DOT_RADIUS = 7;
@@ -2074,12 +2110,14 @@ export const DiagramEditorPane = ({
{!readOnly && (
document.kind === "mind-map" ? (
-
-
-
-
- {t("diagram.mindMapShortcuts")}
-
+
addNode("topic", { relation: "child" }) },
+ { icon: ListTree, label: t("diagram.addSiblingTopic"), onSelect: () => addNode("topic", { relation: "sibling" }) },
+ ]}
+ />
) : document.kind === "architecture" ? (
<>
) : (
<>
-
-
-
-
- {t("diagram.flowchartShortcuts")}
-
- {t("diagram.addDecision")}
- {t("diagram.addTerminator")}
+ addNode("process") },
+ { icon: Diamond, label: t("diagram.addDecision"), onSelect: () => addNode("decision") },
+ { icon: Circle, label: t("diagram.addTerminator"), onSelect: () => addNode("terminator") },
+ ]}
+ />
{t("diagram.connectHint")}
>
)
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index e96aed5b..a5e7a7b6 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -250,6 +250,7 @@ export const enUS = {
title: "Diagram title",
canvas: "{{type}} canvas",
addTopic: "Add child topic",
+ addSiblingTopic: "Add sibling topic",
mindMapShortcuts: "Tab adds a child; Enter adds a sibling",
addStep: "Add step",
flowchartShortcuts: "Tab connects the next node; Enter edits; Cmd/Ctrl+D duplicates; arrow keys nudge",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index b63975da..431f0f15 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -250,6 +250,7 @@ export const zhCN = {
title: "图表标题",
canvas: "{{type}}画布",
addTopic: "添加子主题",
+ addSiblingTopic: "添加同级主题",
mindMapShortcuts: "Tab 添加子主题,Enter 添加同级主题",
addStep: "添加步骤",
flowchartShortcuts: "Tab 连接后续节点,Enter 编辑,⌘/Ctrl+D 复制,方向键微调",