From 57ec5675799bb539cd57091107584c77c76f4aa8 Mon Sep 17 00:00:00 2001 From: Nikolai Iakushchenko Date: Wed, 11 Jan 2023 15:12:52 +0300 Subject: [PATCH] #1887 Add s-group data for atom or bond without selection (#2080) --- packages/ketcher-react/src/script/editor/tool/sgroup.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/ketcher-react/src/script/editor/tool/sgroup.ts b/packages/ketcher-react/src/script/editor/tool/sgroup.ts index 4be43ec1f9..41f23875d4 100644 --- a/packages/ketcher-react/src/script/editor/tool/sgroup.ts +++ b/packages/ketcher-react/src/script/editor/tool/sgroup.ts @@ -442,8 +442,10 @@ class SGroupTool { } // TODO: handle click on an existing group? - if (id !== null || (selection && selection.atoms)) + if (id !== null || (selection && selection.atoms)) { + this.editor.selection(selection) SGroupTool.sgroupDialog(this.editor, id, this.type) + } } cancel() { @@ -461,11 +463,6 @@ class SGroupTool { const type = sg ? sg.type : defaultType const eventName = type === 'DAT' ? 'sdataEdit' : 'sgroupEdit' - if (!selection.atoms && !selection.bonds && !sg) { - console.info('There is no selection or sgroup') - return - } - let attrs if (sg) { attrs = sg.getAttrs()