Skip to content

开源白板工具(SaaS),一体化白板,包含思维导图、流程图、自由画等。All in one open-source whiteboard tool with mind, flowchart, freehand and etc.

fix(hotkey): prevent hotkey when type normally (#189)

pubuzhixing8dbc86d746918
diff --git a/packages/drawnix/src/plugins/with-hotkey.ts b/packages/drawnix/src/plugins/with-hotkey.ts
index 0d12245..cc378d1 100644
--- a/packages/drawnix/src/plugins/with-hotkey.ts
+++ b/packages/drawnix/src/plugins/with-hotkey.ts
@@ -14,9 +14,14 @@ export const buildDrawnixHotkeyPlugin = (
const withDrawnixHotkey = (board: PlaitBoard) => {
const { globalKeyDown } = board;
board.globalKeyDown = (event: KeyboardEvent) => {
+ const isTypingNormal =
+ event.target instanceof HTMLInputElement ||
+ event.target instanceof HTMLTextAreaElement;
if (
- PlaitBoard.getMovingPointInBoard(board) ||
- PlaitBoard.isMovingPointInBoard(board)
+ !isTypingNormal &&
+ (PlaitBoard.getMovingPointInBoard(board) ||
+ PlaitBoard.isMovingPointInBoard(board)) &&
+ !PlaitBoard.hasBeenTextEditing(board)
) {
if (isHotkey(['mod+shift+e'], { byKey: true })(event)) {
saveAsImage(board, true);