Skip to content

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

feat: support save as json from hotkey

pubuzhixing8120dffa161a3
diff --git a/packages/drawnix/src/plugins/with-hotkey.ts b/packages/drawnix/src/plugins/with-hotkey.ts
index f115baf..6e0645c 100644
--- a/packages/drawnix/src/plugins/with-hotkey.ts
+++ b/packages/drawnix/src/plugins/with-hotkey.ts
@@ -1,6 +1,7 @@
import { PlaitBoard } from '@plait/core';
import { isHotkey } from 'is-hotkey';
import { saveAsPNG } from '../utils/image';
+import { saveAsJSON } from '../data/json';
export const withDrawnixHotkey = (board: PlaitBoard) => {
const { globalKeyDown } = board;
@@ -14,6 +15,11 @@ export const withDrawnixHotkey = (board: PlaitBoard) => {
event.preventDefault();
return;
}
+ if (isHotkey(['mod+s'], { byKey: true })(event)) {
+ saveAsJSON(board);
+ event.preventDefault();
+ return;
+ }
}
globalKeyDown(event);
};