fix(脑图): 未规划节点不允许剪切、删除、复制、粘贴

This commit is contained in:
baiqi 2024-08-16 14:13:18 +08:00 committed by Craftsman
parent 5fe953a8d7
commit 550a8fe96e
2 changed files with 21 additions and 0 deletions

View File

@ -16,6 +16,7 @@
:can-show-enter-node="canShowEnterNode" :can-show-enter-node="canShowEnterNode"
:insert-sibling-menus="insertSiblingMenus" :insert-sibling-menus="insertSiblingMenus"
:insert-son-menus="insertSonMenus" :insert-son-menus="insertSonMenus"
:can-show-more-menu-node-operation="canShowMoreMenuNodeOperation()"
:can-show-paste-menu="!stopPaste()" :can-show-paste-menu="!stopPaste()"
:can-show-more-menu="canShowMoreMenu()" :can-show-more-menu="canShowMoreMenu()"
:can-show-priority-menu="canShowPriorityMenu()" :can-show-priority-menu="canShowPriorityMenu()"
@ -147,6 +148,7 @@
handleContentChange, handleContentChange,
replaceableTags, replaceableTags,
priorityDisableCheck, priorityDisableCheck,
canShowMoreMenuNodeOperation,
} = useMinderBaseApi({ hasEditPermission }); } = useMinderBaseApi({ hasEditPermission });
const importJson = ref<MinderJson>({ const importJson = ref<MinderJson>({
root: {} as MinderJsonNode, root: {} as MinderJsonNode,

View File

@ -640,6 +640,24 @@ export default function useMinderBaseApi({ hasEditPermission }: { hasEditPermiss
return true; return true;
} }
/**
* ()
*/
function canShowMoreMenuNodeOperation() {
if (window.minder) {
const node: MinderJsonNode = window.minder.getSelectedNode();
if (node?.data?.id === 'NONE') {
// 虚拟根节点不展示节点操作
return false;
}
if (node?.data?.resource?.includes(moduleTag) && node?.data?.id === 'root') {
// 根模块节点不展示节点操作
return false;
}
}
return true;
}
/** /**
* *
* @param event * @param event
@ -732,5 +750,6 @@ export default function useMinderBaseApi({ hasEditPermission }: { hasEditPermiss
handleContentChange, handleContentChange,
replaceableTags, replaceableTags,
priorityDisableCheck, priorityDisableCheck,
canShowMoreMenuNodeOperation,
}; };
} }