Don't select sibling on attachment removal if attachment was unselected
Fixes #1173
This commit is contained in:
parent
60b2e16746
commit
333675d8ea
|
@ -901,9 +901,10 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio
|
|||
this.rememberSelection(savedSelection);
|
||||
}
|
||||
}
|
||||
// On removal of a row, select item at previous position
|
||||
// On removal of a selected row, select item at previous position
|
||||
else if (savedSelection.length) {
|
||||
if (action == 'remove' || action == 'trash' || action == 'delete') {
|
||||
if ((action == 'remove' || action == 'trash' || action == 'delete')
|
||||
&& savedSelection.some(id => this.getRowIndexByID(id) === false)) {
|
||||
// In duplicates view, select the next set on delete
|
||||
if (collectionTreeRow.isDuplicates()) {
|
||||
if (this._rows[previousFirstSelectedRow]) {
|
||||
|
|
|
@ -269,7 +269,17 @@ describe("Zotero.ItemTreeView", function() {
|
|||
assert.equal(itemsView.selection.currentIndex, 2);
|
||||
|
||||
yield Zotero.Items.erase(items.map(item => item.id));
|
||||
})
|
||||
});
|
||||
|
||||
it("shouldn't select sibling on attachment erase if attachment wasn't selected", function* () {
|
||||
var item = yield createDataObject('item');
|
||||
var att1 = yield importFileAttachment('test.png', { title: 'A', parentItemID: item.id });
|
||||
var att2 = yield importFileAttachment('test.png', { title: 'B', parentItemID: item.id });
|
||||
yield zp.itemsView.selectItem(att2.id); // expand
|
||||
yield zp.itemsView.selectItem(item.id);
|
||||
yield att1.eraseTx();
|
||||
assert.sameMembers(zp.itemsView.getSelectedItems(true), [item.id]);
|
||||
});
|
||||
|
||||
it("should keep first visible item in view when other items are added with skipSelect and nothing in view is selected", function* () {
|
||||
var collection = yield createDataObject('collection');
|
||||
|
|
Loading…
Reference in New Issue
Block a user