feat(mindmap): 打开图标/备注/公式侧栏并显示官方触发项

This commit is contained in:
liaibo
2025-12-29 07:25:03 +08:00
parent 57ef318350
commit c34b5ac911
2 changed files with 8 additions and 14 deletions
@@ -345,9 +345,7 @@ const MindmapBlockView = ({
};
const handleIcon = () => {
const value = createSimplePrompt("请输入内置图标键(示例:priority_1 或 progress_2", "priority_1");
if (!value) return;
applyToActiveNodes(mindmap, (node) => mindmap?.execCommand("SET_NODE_ICON", node, [value]));
setActiveSidebar("icons");
};
const handleLink = () => {
@@ -357,9 +355,7 @@ const MindmapBlockView = ({
};
const handleNote = () => {
const note = createSimplePrompt("请输入备注内容");
if (!note) return;
applyToActiveNodes(mindmap, (node) => mindmap?.execCommand("SET_NODE_NOTE", node, note));
setActiveSidebar("note");
};
const handleTag = () => {
@@ -370,9 +366,7 @@ const MindmapBlockView = ({
};
const handleFormula = () => {
const formula = createSimplePrompt("输入 LaTeX 公式(示例:a^2+b^2=c^2", "a^2+b^2=c^2");
if (!formula) return;
mindmap?.execCommand("INSERT_FORMULA", formula, mindmap?.renderer?.activeNodeList ?? []);
setActiveSidebar("formula");
};
const handleAttachment = () => {
@@ -26,11 +26,11 @@ export const sidebarTriggers: SidebarTrigger[] = [
{ value: "structure", target: "structure", label: "结构", iconClass: "iconjiegou" },
{ value: "outline", target: "outline", label: "大纲", iconClass: "iconfuhao-dagangshu" },
{ value: "shortcutKey", target: "settings", label: "快捷键/设置", iconClass: "iconjianpan" },
// 扩展:图标/公式/备注/AI官方通过按钮唤起,这里隐藏不展示但支持被触发
{ value: "icons", target: "icons", label: "图标/贴纸", iconClass: "iconxiaolian", visible: false },
{ value: "formula", target: "formula", label: "公式", iconClass: "icongongshi", visible: false },
{ value: "note", target: "note", label: "备注", iconClass: "iconflow-Mark", visible: false },
{ value: "ai", target: "ai", label: "AI", iconClass: "iconstar", visible: false },
// 扩展:图标/公式/备注/AI默认全部可见,保持和官方一致
{ value: "icons", target: "icons", label: "图标/贴纸", iconClass: "iconxiaolian", visible: true },
{ value: "formula", target: "formula", label: "公式", iconClass: "icongongshi", visible: true },
{ value: "note", target: "note", label: "备注", iconClass: "iconflow-Mark", visible: true },
{ value: "ai", target: "ai", label: "AI", iconClass: "iconstar", visible: true },
];
export const sidebarTitles: Record<SidebarPanel, string> = {