Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSK-685: prioritise selection when focus exists #2648

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions plugins/view-resources/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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,
Expand Down