Don't change selection unnecessarily when creating trashed item
This commit is contained in:
parent
27f6f018d3
commit
0d1d4ee5cb
|
@ -823,14 +823,14 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio
|
|||
}
|
||||
}
|
||||
|
||||
if (sort) {
|
||||
yield this.sort(typeof sort == 'number' ? sort : false);
|
||||
}
|
||||
else {
|
||||
this._refreshItemRowMap();
|
||||
}
|
||||
|
||||
if (singleSelect) {
|
||||
if (sort) {
|
||||
yield this.sort(typeof sort == 'number' ? sort : false);
|
||||
}
|
||||
else {
|
||||
this._refreshItemRowMap();
|
||||
}
|
||||
|
||||
if (!extraData[singleSelect] || !extraData[singleSelect].skipSelect) {
|
||||
// Reset to Info tab
|
||||
this._ownerDocument.getElementById('zotero-view-tabbox').selectedIndex = 0;
|
||||
|
@ -841,19 +841,14 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio
|
|||
else if (action == 'modify' && ids.length == 1 &&
|
||||
savedSelection.length == 1 && savedSelection[0] == ids[0]) {
|
||||
// If the item no longer matches the search term, clear the search
|
||||
// DEBUG: Still needed/wanted? (and search is async, so doesn't work anyway,
|
||||
// here or above)
|
||||
if (quicksearch && this._rowMap[ids[0]] == undefined) {
|
||||
Zotero.debug('Selected item no longer matches quicksearch -- clearing');
|
||||
quicksearch.value = '';
|
||||
quicksearch.doCommand();
|
||||
}
|
||||
|
||||
if (sort) {
|
||||
yield this.sort(typeof sort == 'number' ? sort : false);
|
||||
}
|
||||
else {
|
||||
this._refreshItemRowMap();
|
||||
}
|
||||
|
||||
if (activeWindow) {
|
||||
yield this.selectItem(ids[0]);
|
||||
}
|
||||
|
@ -861,16 +856,8 @@ Zotero.ItemTreeView.prototype.notify = Zotero.Promise.coroutine(function* (actio
|
|||
yield this.rememberSelection(savedSelection);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sort) {
|
||||
yield this.sort(typeof sort == 'number' ? sort : false);
|
||||
}
|
||||
else {
|
||||
this._refreshItemRowMap();
|
||||
}
|
||||
|
||||
// On removal of a row, select item at previous position
|
||||
// On removal of a row, select item at previous position
|
||||
else if (savedSelection.length) {
|
||||
if (action == 'remove' || action == 'trash' || action == 'delete') {
|
||||
// In duplicates view, select the next set on delete
|
||||
if (collectionTreeRow.isDuplicates()) {
|
||||
|
|
|
@ -116,6 +116,23 @@ describe("Zotero.ItemTreeView", function() {
|
|||
assert.equal(selected[0], existingItemID);
|
||||
});
|
||||
|
||||
it("shouldn't change selection outside of trash if new trashed item is created with skipSelect", function* () {
|
||||
yield selectLibrary(win);
|
||||
yield waitForItemsLoad(win);
|
||||
|
||||
itemsView.selection.clearSelection();
|
||||
|
||||
var item = createUnsavedDataObject('item');
|
||||
item.deleted = true;
|
||||
var id = yield item.saveTx({
|
||||
skipSelect: true
|
||||
});
|
||||
|
||||
// Nothing should be selected
|
||||
selected = itemsView.getSelectedItems(true);
|
||||
assert.lengthOf(selected, 0);
|
||||
})
|
||||
|
||||
it("shouldn't select a modified item", function* () {
|
||||
// Create item
|
||||
var item = new Zotero.Item('book');
|
||||
|
|
Loading…
Reference in New Issue
Block a user