From 20de06ef5085b036e9e55c6f447bd7b32b71377f Mon Sep 17 00:00:00 2001 From: David Luzar Date: Wed, 9 Mar 2022 10:59:44 +0100 Subject: [PATCH] fix: paste styles shortcut (#4886) Co-authored-by: Aakansha Doshi --- src/actions/actionDistribute.tsx | 8 ++-- src/actions/actionStyles.test.tsx | 71 ++++++++++++++++++++++++++++++ src/actions/manager.tsx | 3 ++ src/tests/contextmenu.test.tsx | 16 ++----- src/tests/helpers/ui.ts | 8 ++++ src/tests/regressionTests.test.tsx | 24 ++++------ 6 files changed, 99 insertions(+), 31 deletions(-) create mode 100644 src/actions/actionStyles.test.tsx diff --git a/src/actions/actionDistribute.tsx b/src/actions/actionDistribute.tsx index 578a4a57..5b61e44d 100644 --- a/src/actions/actionDistribute.tsx +++ b/src/actions/actionDistribute.tsx @@ -7,7 +7,7 @@ import { distributeElements, Distribution } from "../disitrubte"; import { getNonDeletedElements } from "../element"; import { ExcalidrawElement } from "../element/types"; import { t } from "../i18n"; -import { CODES } from "../keys"; +import { CODES, KEYS } from "../keys"; import { getSelectedElements, isSomeElementSelected } from "../scene"; import { AppState } from "../types"; import { arrayToMap, getShortcutKey } from "../utils"; @@ -49,7 +49,8 @@ export const distributeHorizontally = register({ commitToHistory: true, }; }, - keyTest: (event) => event.altKey && event.code === CODES.H, + keyTest: (event) => + !event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.H, PanelComponent: ({ elements, appState, updateData }) => (