diff --git a/frontend/src/components/business/ms-minders/featureCaseMinder/index.vue b/frontend/src/components/business/ms-minders/featureCaseMinder/index.vue index 5c088a2082..7fcd48cd00 100644 --- a/frontend/src/components/business/ms-minders/featureCaseMinder/index.vue +++ b/frontend/src/components/business/ms-minders/featureCaseMinder/index.vue @@ -229,6 +229,7 @@ count: props.modulesCount[e.id], isNew: false, changed: false, + disabled: ['NONE', 'root'].includes(e.id || e.data?.id), // 全部模块节点和根节点不可编辑文本 }, children: props.modulesCount[e.id] > 0 && !e.children?.length diff --git a/frontend/src/components/pure/ms-minder-editor/hooks/useShortCut.ts b/frontend/src/components/pure/ms-minder-editor/hooks/useShortCut.ts index 2f4637cf62..f295ea1bdd 100644 --- a/frontend/src/components/pure/ms-minder-editor/hooks/useShortCut.ts +++ b/frontend/src/components/pure/ms-minder-editor/hooks/useShortCut.ts @@ -59,7 +59,6 @@ export default function useShortCut(shortcuts: Shortcuts, options: MinderOperati 'enter': 'appendSiblingNode', 'tab': 'appendChildNode', 'backspace': 'delete', - 'f2': 'input', // 进入编辑状态 }; // 业务快捷键 const businessShortcuts: { [key: string]: ShortcutKey } = { @@ -98,6 +97,27 @@ export default function useShortCut(shortcuts: Shortcuts, options: MinderOperati } }; + const handleShortcutInput = (event: KeyboardEvent) => { + const { editor } = window; + const { fsm } = editor; + const state = fsm.state(); + switch (state) { + case 'input': { + // 输入状态下不响应快捷键 + return; + } + default: + } + const key = event.key.toLowerCase(); + + if (key === 'f2') { + // 执行快捷键编辑事件 + if (shortcuts.input) { + shortcuts.input(event); + } + } + }; + const handleShortcutSave = (event: KeyboardEvent) => { const { editor } = window; const { fsm } = editor; @@ -124,6 +144,7 @@ export default function useShortCut(shortcuts: Shortcuts, options: MinderOperati const minderContainer = document.querySelector('.ms-minder-container'); if (minderContainer) { window.addEventListener('keydown', handleShortcutSave); + window.addEventListener('keydown', handleShortcutInput); minderContainer.addEventListener('keydown', (e) => handleKeyDown(e as KeyboardEvent)); minderContainer.addEventListener('copy', (e) => minderCopy(e as ClipboardEvent)); minderContainer.addEventListener('cut', (e) => minderCut(e as ClipboardEvent)); @@ -135,6 +156,7 @@ export default function useShortCut(shortcuts: Shortcuts, options: MinderOperati const minderContainer = document.querySelector('.ms-minder-container'); if (minderContainer) { window.removeEventListener('keydown', handleShortcutSave); + window.removeEventListener('keydown', handleShortcutInput); minderContainer.removeEventListener('keydown', (e) => handleKeyDown(e as KeyboardEvent)); minderContainer.removeEventListener('copy', (e) => minderCopy(e as ClipboardEvent)); minderContainer.removeEventListener('cut', (e) => minderCut(e as ClipboardEvent));