Fixed regressions:
- Fixed error in attachment saving from r1715 - Fix broken item adding from r1721 Other fixes: - Dropping a regular item and a note/attachment item onto another item would throw an error (drop onto an item is now disallowed if any regular items in the drag) - Dragging a top-level note/attachment onto a parent item would toggle the open/close state of the target
This commit is contained in:
parent
f20d42728b
commit
1c3d1438e4
|
@ -455,7 +455,9 @@ Zotero.Attachments = new function(){
|
||||||
var f = function() {
|
var f = function() {
|
||||||
Zotero.Fulltext.indexDocument(document, itemID);
|
Zotero.Fulltext.indexDocument(document, itemID);
|
||||||
Zotero.Notifier.trigger('refresh', 'item', itemID);
|
Zotero.Notifier.trigger('refresh', 'item', itemID);
|
||||||
callback();
|
if (callback) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -739,7 +739,8 @@ Zotero.ItemTreeView.prototype.sort = function(itemID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Single child item sort -- just toggle parent open and closed
|
// Single child item sort -- just toggle parent open and closed
|
||||||
if (itemID && this._getItemAtRow(this._itemRowMap[itemID]).ref.getSource()) {
|
if (itemID && this._itemRowMap[itemID] &&
|
||||||
|
this._getItemAtRow(this._itemRowMap[itemID]).ref.getSource()) {
|
||||||
var parentIndex = this.getParentIndex(this._itemRowMap[itemID]);
|
var parentIndex = this.getParentIndex(this._itemRowMap[itemID]);
|
||||||
this.toggleOpenState(parentIndex);
|
this.toggleOpenState(parentIndex);
|
||||||
this.toggleOpenState(parentIndex);
|
this.toggleOpenState(parentIndex);
|
||||||
|
@ -991,12 +992,19 @@ Zotero.ItemTreeView.prototype.selectItem = function(id, expand, noRecurse)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.toggleOpenState(parentRow); //opens the parent of the item
|
|
||||||
|
// If parent is already open and we haven't found the item, the child
|
||||||
|
// hasn't yet been added to the view, so close parent to allow refresh
|
||||||
|
if (this.isContainerOpen(parentRow)) {
|
||||||
|
this.toggleOpenState(parentRow);
|
||||||
|
}
|
||||||
|
// Open the parent
|
||||||
|
this.toggleOpenState(parentRow);
|
||||||
row = this._itemRowMap[id];
|
row = this._itemRowMap[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selection.select(row);
|
this.selection.select(row);
|
||||||
// If _expand_, open container
|
// If |expand|, open row if container
|
||||||
if (expand && this.isContainer(row) && !this.isContainerOpen(row)) {
|
if (expand && this.isContainer(row) && !this.isContainerOpen(row)) {
|
||||||
this.toggleOpenState(row);
|
this.toggleOpenState(row);
|
||||||
}
|
}
|
||||||
|
@ -1774,16 +1782,24 @@ Zotero.ItemTreeView.prototype.canDrop = function(row, orient)
|
||||||
// Directly on a row
|
// Directly on a row
|
||||||
if (orient == 0)
|
if (orient == 0)
|
||||||
{
|
{
|
||||||
for each(var id in ids)
|
var canDrop = false;
|
||||||
{
|
for each(var id in ids) {
|
||||||
var item = Zotero.Items.get(id);
|
var item = Zotero.Items.get(id);
|
||||||
|
|
||||||
|
// If any regular items, disallow drop
|
||||||
|
if (item.isRegularItem()) {
|
||||||
|
canDrop = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Only allow dragging of notes and attachments
|
// Only allow dragging of notes and attachments
|
||||||
// that aren't already children of the item
|
// that aren't already children of the item
|
||||||
if (!item.isRegularItem() && item.getSource()!=rowItem.getID())
|
if (item.getSource() != rowItem.getID()) {
|
||||||
{
|
canDrop = true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return canDrop;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In library, allow children to be dragged out of parent
|
// In library, allow children to be dragged out of parent
|
||||||
|
|
Loading…
Reference in New Issue
Block a user