Skip to content

Commit

Permalink
Merge pull request #3675 from specify/issue-3174
Browse files Browse the repository at this point in the history
Disallow selecting several times a cell in WB
  • Loading branch information
CarolineDenis authored Jul 10, 2023
2 parents 4ad26fd + 0eaf77a commit 207df9a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions specifyweb/frontend/js_src/lib/components/WorkBench/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,21 @@ export function getHotHooks(wbView: WbView) {
10
);
},

/*
* Disallow user from selecting several times the same cell
*/
afterSelection: () => {
if (wbView.hot === undefined) return;
const selection = wbView.hot?.getSelected() ?? [];
const newSelection = f
.unique(selection.map((row) => JSON.stringify(row)))
.map((row) => JSON.parse(row));
if (newSelection.length !== selection.length) {
wbView.hot?.deselectCell();
wbView.hot?.selectCells(newSelection);
}
},
});
}

Expand Down

0 comments on commit 207df9a

Please sign in to comment.