fix(단축키): 전역 Ctrl 단축키 한글 자판 대응 · 공용 판정 함수(214-2)
- A00_Common/key_shortcut.ts 새로 — 영문이면 글자 · 아니면 자판 자리(code) · CAD 와 페이지가 같이 씀 - CAD input-shortcut.ts 는 공용을 다시 내보냄 · tsconfig.app.json 에 공용 파일 포함 - B05 종단 Ctrl+Z · 노선 편집 Ctrl+Z · Y · M02 흐름도 Ctrl+Z · 카드 Ctrl+S · 나무 Ctrl+C · V · 시트 Ctrl+글자 - 시트 키는 한글 조합 중에도 Ctrl+글자 판정 - 새 시험 ctrl-shortcut-hangul · ctrl-shortcut-sheet Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STqEqztUthVFBmEP18wBSz
This commit is contained in:
@@ -1,24 +1,10 @@
|
||||
/** Ctrl 단축키 이름 */
|
||||
export type CtrlShortcut = 'undo' | 'redo' | 'save' | 'selectAll';
|
||||
|
||||
/**
|
||||
* Ctrl 단축키 판정 — 글자(`key`)가 아니라 자판 자리(`code`).
|
||||
* 한글 자판은 `key` 가 「ㅋ」·「ㅛ」로 오고, Shift 를 누르면 `key` 가 대문자(「Z」)라 글자로는 안 맞는다.
|
||||
* Ctrl 단축키 판정 — 공용 `A00_Common/key_shortcut.ts`(214-2)를 그대로 내보냄.
|
||||
* 한글 자판은 `key` 가 「ㅋ」·「ㅛ」로 와 글자로는 안 맞아 자판 자리(`code`)로 본다.
|
||||
*/
|
||||
export function ctrlShortcut(
|
||||
evt: Pick<KeyboardEvent, 'ctrlKey' | 'altKey' | 'shiftKey' | 'code'>
|
||||
): CtrlShortcut | null {
|
||||
if (!evt.ctrlKey || evt.altKey) return null;
|
||||
switch (evt.code) {
|
||||
case 'KeyZ':
|
||||
return evt.shiftKey ? 'redo' : 'undo';
|
||||
case 'KeyY':
|
||||
return evt.shiftKey ? null : 'redo';
|
||||
case 'KeyS':
|
||||
return evt.shiftKey ? null : 'save';
|
||||
case 'KeyA':
|
||||
return evt.shiftKey ? null : 'selectAll';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
export {
|
||||
ctrlShortcut,
|
||||
isCtrlKey,
|
||||
keyLetter,
|
||||
type CtrlShortcut,
|
||||
} from '../../../../A00_Common/key_shortcut';
|
||||
|
||||
Reference in New Issue
Block a user