no message

This commit is contained in:
KuroSago 2025-05-08 14:34:17 +08:00
parent e8802a03ec
commit e15070f4f7

View File

@ -49,14 +49,10 @@ export function getCustomNodeContent() {
create: (node: MindMapNode) => { create: (node: MindMapNode) => {
// 创建包含按钮的容器 // 创建包含按钮的容器
const container = document.createElement("div"); const container = document.createElement("div");
container.style.display = "flex";
container.style.gap = `${buttonConfig.gap}px`; container.style.gap = `${buttonConfig.gap}px`;
// 默认隐藏按钮组 // 默认隐藏按钮组 - 使用 display:none 节省DOM资源
container.style.visibility = "hidden"; container.style.display = "none";
container.style.opacity = "0";
container.style.transition = "opacity 0.2s";
// 存储容器元素以便后续更新 // 存储容器元素以便后续更新
nodeElements[node.uid] = container; nodeElements[node.uid] = container;
@ -66,8 +62,7 @@ export function getCustomNodeContent() {
// 如果节点已激活,显示按钮组 // 如果节点已激活,显示按钮组
if (node.nodeData.data.isActive) { if (node.nodeData.data.isActive) {
container.style.visibility = "visible"; container.style.display = "flex";
container.style.opacity = "1";
} }
function createButton( function createButton(
@ -98,7 +93,7 @@ export function getCustomNodeContent() {
btn.onclick = (e) => { btn.onclick = (e) => {
e.stopPropagation(); e.stopPropagation();
// const { getMindMapInstance } = useMindMapStore(); const { getMindMapInstance } = useMindMapStore();
// 根据按钮类型执行不同操作 // 根据按钮类型执行不同操作
switch (action) { switch (action) {
@ -121,7 +116,8 @@ export function getCustomNodeContent() {
}); });
break; break;
case "edit": case "edit":
// 获取实例并编辑当前节点
break; break;
} }
}; };
@ -155,8 +151,7 @@ export function getCustomNodeContent() {
nodeActiveState[node.uid] = isActive; nodeActiveState[node.uid] = isActive;
const container = nodeElements[node.uid]; const container = nodeElements[node.uid];
if (container) { if (container) {
container.style.visibility = isActive ? "visible" : "hidden"; container.style.display = isActive ? "flex" : "none";
container.style.opacity = isActive ? "1" : "0";
} }
} }
} }
@ -175,7 +170,6 @@ export function getCustomNodeContent() {
element, element,
node, node,
}: { }: {
content: any;
element: any; element: any;
node: MindMapNode; node: MindMapNode;
}) => { }) => {
@ -190,8 +184,7 @@ export function getCustomNodeContent() {
const isActive = node.nodeData.data.isActive || false; const isActive = node.nodeData.data.isActive || false;
const container = nodeElements[node.uid]; const container = nodeElements[node.uid];
if (container) { if (container) {
container.style.visibility = isActive ? "visible" : "hidden"; container.style.display = isActive ? "flex" : "none";
container.style.opacity = isActive ? "1" : "0";
} }
}, },
}; };