feat(脑图): 脑图屏蔽撤销重做&快捷键拦截调整
This commit is contained in:
parent
de69c69230
commit
bd2076b718
|
@ -449,7 +449,11 @@
|
||||||
waitingRenderNodes.push(moreNode);
|
waitingRenderNodes.push(moreNode);
|
||||||
}
|
}
|
||||||
window.minder.renderNodeBatch(waitingRenderNodes);
|
window.minder.renderNodeBatch(waitingRenderNodes);
|
||||||
|
if (node.parent) {
|
||||||
|
node.parent?.layout();
|
||||||
|
} else {
|
||||||
node.layout();
|
node.layout();
|
||||||
|
}
|
||||||
data.isLoaded = true;
|
data.isLoaded = true;
|
||||||
// 加载完用例数据后,更新当前importJson数据
|
// 加载完用例数据后,更新当前importJson数据
|
||||||
replaceNodeInTree([importJson.value.root], node.data?.id || '', window.minder.exportNode(node), 'data', 'id');
|
replaceNodeInTree([importJson.value.root], node.data?.id || '', window.minder.exportNode(node), 'data', 'id');
|
||||||
|
|
|
@ -44,6 +44,7 @@ export default function useMinderOperation({
|
||||||
*/
|
*/
|
||||||
const minderCopy = (e?: ClipboardEvent) => {
|
const minderCopy = (e?: ClipboardEvent) => {
|
||||||
if (!canShowMoreMenuNodeOperation) {
|
if (!canShowMoreMenuNodeOperation) {
|
||||||
|
e?.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { editor } = window;
|
const { editor } = window;
|
||||||
|
@ -69,6 +70,7 @@ export default function useMinderOperation({
|
||||||
*/
|
*/
|
||||||
const minderCut = (e?: ClipboardEvent) => {
|
const minderCut = (e?: ClipboardEvent) => {
|
||||||
if (!canShowMoreMenuNodeOperation) {
|
if (!canShowMoreMenuNodeOperation) {
|
||||||
|
e?.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { editor } = window;
|
const { editor } = window;
|
||||||
|
@ -103,7 +105,8 @@ export default function useMinderOperation({
|
||||||
* 执行粘贴
|
* 执行粘贴
|
||||||
*/
|
*/
|
||||||
const minderPaste = (e?: ClipboardEvent) => {
|
const minderPaste = (e?: ClipboardEvent) => {
|
||||||
if (!canShowMoreMenuNodeOperation || !canShowPasteMenu) {
|
if (!canShowMoreMenuNodeOperation && !canShowPasteMenu) {
|
||||||
|
e?.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { editor } = window;
|
const { editor } = window;
|
||||||
|
|
|
@ -15,8 +15,8 @@ export default function useShortCut(shortcuts: Shortcuts, options: MinderOperati
|
||||||
|
|
||||||
// 定义组合键事件
|
// 定义组合键事件
|
||||||
const combinationShortcuts: { [key: string]: ShortcutKey } = {
|
const combinationShortcuts: { [key: string]: ShortcutKey } = {
|
||||||
z: 'undo', // 撤销
|
// z: 'undo', // 撤销 TODO:暂时不上撤销和重做
|
||||||
y: 'redo', // 重做
|
// y: 'redo', // 重做
|
||||||
enter: 'enter', // 进入节点
|
enter: 'enter', // 进入节点
|
||||||
};
|
};
|
||||||
// 定义单键事件
|
// 定义单键事件
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-minder-shortcut-trigger-listitem">
|
<!-- <div class="ms-minder-shortcut-trigger-listitem">
|
||||||
<div>{{ t('minder.main.history.undo') }}</div>
|
<div>{{ t('minder.main.history.undo') }}</div>
|
||||||
<div class="flex items-center gap-[4px]">
|
<div class="flex items-center gap-[4px]">
|
||||||
<div class="ms-minder-shortcut-trigger-listitem-icon">
|
<div class="ms-minder-shortcut-trigger-listitem-icon">
|
||||||
|
@ -118,14 +118,14 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-minder-shortcut-trigger-listitem-icon">Z</div>
|
<div class="ms-minder-shortcut-trigger-listitem-icon">Z</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="ms-minder-shortcut-trigger-listitem">
|
<div class="ms-minder-shortcut-trigger-listitem">
|
||||||
<div>{{ t('common.delete') }}</div>
|
<div>{{ t('common.delete') }}</div>
|
||||||
<div class="ms-minder-shortcut-trigger-listitem-icon">
|
<div class="ms-minder-shortcut-trigger-listitem-icon">
|
||||||
<MsIcon type="icon-icon_carriage_return1" />
|
<MsIcon type="icon-icon_carriage_return1" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-minder-shortcut-trigger-listitem">
|
<!-- <div class="ms-minder-shortcut-trigger-listitem">
|
||||||
<div>{{ t('minder.main.history.redo') }}</div>
|
<div>{{ t('minder.main.history.redo') }}</div>
|
||||||
<div class="flex items-center gap-[4px]">
|
<div class="flex items-center gap-[4px]">
|
||||||
<div class="ms-minder-shortcut-trigger-listitem-icon">
|
<div class="ms-minder-shortcut-trigger-listitem-icon">
|
||||||
|
@ -133,7 +133,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-minder-shortcut-trigger-listitem-icon">Y</div>
|
<div class="ms-minder-shortcut-trigger-listitem-icon">Y</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</a-trigger>
|
</a-trigger>
|
||||||
|
|
|
@ -117,6 +117,8 @@
|
||||||
|
|
||||||
const { appendChildNode, appendSiblingNode, minderDelete } = useMinderOperation({
|
const { appendChildNode, appendSiblingNode, minderDelete } = useMinderOperation({
|
||||||
insertNode: props.insertNode,
|
insertNode: props.insertNode,
|
||||||
|
canShowMoreMenuNodeOperation: props.canShowMoreMenuNodeOperation,
|
||||||
|
canShowPasteMenu: props.canShowPasteMenu,
|
||||||
});
|
});
|
||||||
const { unbindShortcuts } = useShortCut(
|
const { unbindShortcuts } = useShortCut(
|
||||||
{
|
{
|
||||||
|
@ -133,7 +135,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
delete: () => {
|
delete: () => {
|
||||||
if (props.canShowMoreMenuNodeOperation && props.canShowDeleteMenu) {
|
if (props.canShowMoreMenuNodeOperation && !props.disabled) {
|
||||||
const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes();
|
const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes();
|
||||||
minderDelete(selectedNodes);
|
minderDelete(selectedNodes);
|
||||||
}
|
}
|
||||||
|
@ -169,6 +171,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
insertNode: props.insertNode,
|
insertNode: props.insertNode,
|
||||||
|
canShowMoreMenuNodeOperation: props.canShowMoreMenuNodeOperation,
|
||||||
|
canShowPasteMenu: props.canShowPasteMenu,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue