开源白板工具(SaaS),一体化白板,包含思维导图、流程图、自由画等。All in one open-source whiteboard tool with mind, flowchart, freehand and etc.
fix(hotkey): Prevent Arc browser undo on Cmd+Z in Drawnix (#254)
coderweif600dec663db
diff --git a/packages/drawnix/src/plugins/with-hotkey.ts b/packages/drawnix/src/plugins/with-hotkey.tsindex 412a0c7..d0a0d4c 100644--- a/packages/drawnix/src/plugins/with-hotkey.ts+++ b/packages/drawnix/src/plugins/with-hotkey.ts@@ -17,7 +17,7 @@ export const buildDrawnixHotkeyPlugin = (updateAppState: (appState: Partial<DrawnixState>) => void) => {const withDrawnixHotkey = (board: PlaitBoard) => {- const { globalKeyDown } = board;+ const { globalKeyDown, keyDown } = board;board.globalKeyDown = (event: KeyboardEvent) => {const isTypingNormal =event.target instanceof HTMLInputElement ||@@ -100,6 +100,22 @@ export const buildDrawnixHotkeyPlugin = (globalKeyDown(event);};+ board.keyDown = (event: KeyboardEvent) => {+ if (isHotkey(['mod+z'], { byKey: true })(event)) {+ board.undo();+ event.preventDefault();+ return;+ }++ if (isHotkey(['mod+shift+z'], { byKey: true })(event)) {+ board.redo();+ event.preventDefault();+ return;+ }++ keyDown(event);+ };+return board;};return withDrawnixHotkey;