From bba4bc92ec2f3d2f8930b6a072b1911d92b29da8 Mon Sep 17 00:00:00 2001 From: Yulei Chen Date: Wed, 22 Mar 2023 20:19:06 +0800 Subject: [PATCH] #2113 Hovered structure gets into the saved molecule (#2119) * Fix hovered structure getting into saving * Fix typo Co-authored-by: Nikita * Update variable name --------- Co-authored-by: Nikita --- packages/ketcher-react/src/script/ui/state/hotkeys.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ketcher-react/src/script/ui/state/hotkeys.ts b/packages/ketcher-react/src/script/ui/state/hotkeys.ts index b14ac18331..1708f8574e 100644 --- a/packages/ketcher-react/src/script/ui/state/hotkeys.ts +++ b/packages/ketcher-react/src/script/ui/state/hotkeys.ts @@ -42,9 +42,9 @@ export function initKeydownListener(element) { } } -function removeNotRenderedStruct(actionTool, event, dispatch) { - const { code, metaKey } = event - if (actionTool.tool === 'paste' && code === 'KeyS' && metaKey) { +function removeNotRenderedStruct(actionTool, group, dispatch) { + const affectedTools = ['paste', 'template'] + if (affectedTools.includes(actionTool.tool) && group?.includes('save')) { const savedSelectedTool = SettingsManager.selectionTool dispatch({ type: 'ACTION', @@ -108,7 +108,7 @@ function keyHandle(dispatch, state, hotKeys, event) { } // Removing from what should be saved - structure, which was added to paste tool, // but not yet rendered on canvas - removeNotRenderedStruct(actionTool, event, dispatch) + removeNotRenderedStruct(actionTool, group, dispatch) if (clipArea.actions.indexOf(actName) === -1) { let newAction = actions[actName].action