-
Notifications
You must be signed in to change notification settings - Fork 131
Open
Description
js-screen-shot/src/lib/split-methods/KeyboardEventHandle.ts
Lines 18 to 43 in 2b76afb
| document.body.addEventListener("keydown", (event: KeyboardEvent) => { | |
| // 文本输入框存在时则终止 | |
| if (data.getTextEditState()) { | |
| data.setTextEditState(false); | |
| return; | |
| } | |
| if (event.code === "Escape") { | |
| // ESC按下,触发取消截图事件 | |
| this.triggerEvent("close"); | |
| } | |
| if ( | |
| event.code === "Enter" && | |
| textInputContainer && | |
| textInputContainer.style.display !== "block" | |
| ) { | |
| // Enter按下,触发确认截图事件 | |
| this.triggerEvent("confirm"); | |
| } | |
| // 按下command+z或者ctrl+z快捷键选中撤销工具 | |
| if ((event.metaKey || event.ctrlKey) && event.code === "KeyZ") { | |
| this.triggerEvent("undo"); | |
| } | |
| }); | |
| } |

Metadata
Metadata
Assignees
Labels
No labels