Don't reset selection to top of items list when deleting a child item
This commit is contained in:
parent
1f53fc8202
commit
64455e656e
|
@ -461,6 +461,12 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
|
|||
|
||||
var row = this._itemRowMap[id];
|
||||
|
||||
// Deleted items get a modify that we have to ignore when
|
||||
// not viewing the trash
|
||||
if (item.deleted) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Item already exists in this view
|
||||
if( row != null)
|
||||
{
|
||||
|
@ -499,12 +505,6 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
|
|||
|
||||
else if (((itemGroup.isLibrary() || itemGroup.isGroup()) && itemGroup.ref.libraryID == item.libraryID)
|
||||
|| (itemGroup.isCollection() && item.inCollection(itemGroup.ref.id))) {
|
||||
// Deleted items get a modify that we have to ignore when
|
||||
// not viewing the trash
|
||||
if (item.deleted) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Otherwise the item has to be added
|
||||
if(item.isRegularItem() || !item.getSource())
|
||||
{
|
||||
|
@ -611,7 +611,6 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (singleSelect) {
|
||||
if (sort) {
|
||||
this.sort(typeof sort == 'number' ? sort : false);
|
||||
|
@ -674,6 +673,18 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
|
|||
}
|
||||
}
|
||||
else {
|
||||
// If this was a child item and the next item at this
|
||||
// position is a top-level item, move selection one row
|
||||
// up to select a sibling or parent
|
||||
if (ids.length == 1 && previousRow > 0) {
|
||||
var previousItem = Zotero.Items.get(ids[0]);
|
||||
if (previousItem && previousItem.getSource()) {
|
||||
if (this._dataItems[previousRow] && this.getLevel(previousRow) == 0) {
|
||||
previousRow--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this._dataItems[previousRow]) {
|
||||
this.selection.select(previousRow);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user