From ef4bda2a46fec7c901fe62abeee4e4315e740643 Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Thu, 16 Feb 2023 21:54:15 +0800 Subject: [PATCH] feat:support mac os shortcut --- src/editor/core/shortcut/Shortcut.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/editor/core/shortcut/Shortcut.ts b/src/editor/core/shortcut/Shortcut.ts index 9e5e4ee..7d675cc 100644 --- a/src/editor/core/shortcut/Shortcut.ts +++ b/src/editor/core/shortcut/Shortcut.ts @@ -62,10 +62,13 @@ export class Shortcut { for (let s = 0; s < shortCutList.length; s++) { const shortCut = shortCutList[s] if ( - evt.ctrlKey === !!shortCut.ctrl && + ( + shortCut.mod + ? isMod(evt) === !!shortCut.mod + : evt.ctrlKey === !!shortCut.ctrl && evt.metaKey === !!shortCut.meta + ) && evt.shiftKey === !!shortCut.shift && evt.altKey === !!shortCut.alt && - isMod(evt) === !!shortCut.mod && evt.key === shortCut.key ) { shortCut.callback(this.command)