From e86e7b7acee79c6429a926561581f6c792176a43 Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:03:37 +0300 Subject: [PATCH] Enable deselection in graph for readers --- .../EditorTermGraph/EditorTermGraph.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/EditorTermGraph.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/EditorTermGraph.tsx index 6b025cff..34ac3e1e 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/EditorTermGraph.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/EditorTermGraph.tsx @@ -177,17 +177,22 @@ function EditorTermGraph({ onOpenEdit }: EditorTermGraphProps) { function handleKeyDown(event: React.KeyboardEvent) { // Hotkeys implementation - if (!controller.isContentEditable || controller.isProcessing) { + if (controller.isProcessing) { return; } - if (event.key === 'Delete') { - event.preventDefault(); - handleDeleteCst(); - } if (event.key === 'Escape') { event.preventDefault(); setFocusCst(undefined); controller.deselectAll(); + return; + } + if (!controller.isContentEditable) { + return; + } + if (event.key === 'Delete') { + event.preventDefault(); + handleDeleteCst(); + return; } }