From 463c0a692ae2aee74dd86fcf71720008cd2e4a75 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Thu, 16 Feb 2023 21:09:34 +0500 Subject: [PATCH] TSK-685: prioritise selection when focus exists (#2648) Signed-off-by: Vyacheslav Tumanov --- plugins/view-resources/src/actions.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/view-resources/src/actions.ts b/plugins/view-resources/src/actions.ts index b50770d053..b850963a61 100644 --- a/plugins/view-resources/src/actions.ts +++ b/plugins/view-resources/src/actions.ts @@ -34,10 +34,10 @@ import { FocusSelection } from './selection' */ export function getSelection (focusStore: FocusSelection, selectionStore: Doc[]): Doc[] { let docs: Doc[] = [] - if (selectionStore.find((it) => it._id === focusStore.focus?._id) === undefined && focusStore.focus !== undefined) { - docs = [focusStore.focus] - } else { + if (selectionStore.length > 0) { docs = selectionStore + } else if (focusStore.focus !== undefined) { + docs = [focusStore.focus] } return docs } @@ -46,9 +46,9 @@ export function getSelection (focusStore: FocusSelection, selectionStore: Doc[]) * @public * * Find all action contributions applicable for specified _class. - * If derivedFrom is specifie, only actions applicable to derivedFrom class will be used. + * If derivedFrom is specified, only actions applicable to derivedFrom class will be used. * So if we have contribution for Doc, Space and we ask for SpaceWithStates and derivedFrom=Space, - * we won't recieve Doc contribution but recieve Space ones. + * we won't receive Doc contribution but receive Space ones. */ export async function getActions ( client: Client,