mirror of
https://github.com/zotero/zotero.git
synced 2026-10-05 02:43:38 +00:00
Ignore collection-tree activation when multiple rows are selected
Pressing Enter (or double-clicking) edited the focused row -- renaming a collection or opening the saved-search/feed editor -- even with several rows selected. Activation acts on one row, so ignore it for multi-selection.
This commit is contained in:
parent
ee24c0b468
commit
9e324fe62b
2 changed files with 19 additions and 0 deletions
|
|
@ -245,6 +245,11 @@ var CollectionTree = class CollectionTree extends LibraryTree {
|
|||
}
|
||||
|
||||
handleActivate = (event, indices) => {
|
||||
// Activation (rename collection, edit saved search/feed, open library) acts on
|
||||
// a single row, so ignore it when multiple rows are selected
|
||||
if (this.selection.count > 1) {
|
||||
return;
|
||||
}
|
||||
let index = indices[0];
|
||||
let treeRow = this.getRow(index);
|
||||
if (treeRow.isCollection() && this.editable && this.selection.focused == index) {
|
||||
|
|
|
|||
|
|
@ -709,6 +709,20 @@ describe("Zotero.CollectionTree", function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe("#handleActivate()", function () {
|
||||
it("shouldn't start editing when multiple collections are selected", async function () {
|
||||
let c1 = await createDataObject('collection');
|
||||
let c2 = await createDataObject('collection');
|
||||
await cv.selectByID("C" + c1.id);
|
||||
cv.selection.toggleSelect(cv.getRowIndexByID("C" + c2.id));
|
||||
assert.equal(cv.selection.count, 2);
|
||||
|
||||
cv.handleActivate(new Event('keydown'), [cv.selection.focused]);
|
||||
|
||||
assert.notOk(cv._editing);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#onDrop()", function () {
|
||||
/**
|
||||
* Simulate a drag and drop
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue