Fix some bugs adding items to various views
- Refresh Unfiled Items view when items are added - Fix brief freeze ("too much recursion") adding an item to a search where the new item doesn't appear. Now, select the library root instead if a manually added item doesn't appear in the current view. - Fix immediate closing of title field when adding an item to a collection rather than the library root
This commit is contained in:
parent
5d85bffc9c
commit
1e0674cf7c
|
@ -317,6 +317,8 @@ Zotero.ItemTreeView.prototype._refreshGenerator = function()
|
||||||
|
|
||||||
var usiDisabled = Zotero.UnresponsiveScriptIndicator.disable();
|
var usiDisabled = Zotero.UnresponsiveScriptIndicator.disable();
|
||||||
|
|
||||||
|
Zotero.ItemGroupCache.clear();
|
||||||
|
|
||||||
this._searchMode = this._itemGroup.isSearchMode();
|
this._searchMode = this._itemGroup.isSearchMode();
|
||||||
|
|
||||||
if (!this.selection.selectEventsSuppressed) {
|
if (!this.selection.selectEventsSuppressed) {
|
||||||
|
@ -593,8 +595,6 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
|
||||||
// If trash or saved search, just re-run search
|
// If trash or saved search, just re-run search
|
||||||
if (itemGroup.isTrash() || itemGroup.isSearch())
|
if (itemGroup.isTrash() || itemGroup.isSearch())
|
||||||
{
|
{
|
||||||
Zotero.ItemGroupCache.clear();
|
|
||||||
|
|
||||||
// Clear item type icons
|
// Clear item type icons
|
||||||
var items = Zotero.Items.get(ids);
|
var items = Zotero.Items.get(ids);
|
||||||
for (let i=0; i<items.length; i++) {
|
for (let i=0; i<items.length; i++) {
|
||||||
|
@ -711,16 +711,15 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
|
||||||
}
|
}
|
||||||
else if(action == 'add')
|
else if(action == 'add')
|
||||||
{
|
{
|
||||||
// If saved search or trash, just re-run search
|
// In some modes, just re-run search
|
||||||
if (itemGroup.isSearch() || itemGroup.isTrash()) {
|
if (itemGroup.isSearch() || itemGroup.isTrash() || itemGroup.isUnfiled()) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
madeChanges = true;
|
madeChanges = true;
|
||||||
sort = true;
|
sort = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not a quicksearch and not background window saved search,
|
// If not a quicksearch, process new items manually
|
||||||
// process new items manually
|
else if (!quicksearch || quicksearch.value == '')
|
||||||
else if (quicksearch && quicksearch.value == '')
|
|
||||||
{
|
{
|
||||||
var items = Zotero.Items.get(ids);
|
var items = Zotero.Items.get(ids);
|
||||||
for each(var item in items) {
|
for each(var item in items) {
|
||||||
|
@ -740,7 +739,7 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
|
||||||
sort = (items.length == 1) ? items[0].id : true;
|
sort = (items.length == 1) ? items[0].id : true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Otherwise re-run the search, which refreshes the item list
|
// Otherwise re-run the quick search, which refreshes the item list
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// For item adds, clear the quicksearch, unless all the new items
|
// For item adds, clear the quicksearch, unless all the new items
|
||||||
|
@ -1802,7 +1801,7 @@ Zotero.ItemTreeView.prototype.selectItem = function(id, expand, noRecurse)
|
||||||
// Don't change selection if UI updates are disabled (e.g., during sync)
|
// Don't change selection if UI updates are disabled (e.g., during sync)
|
||||||
if (Zotero.suppressUIUpdates) {
|
if (Zotero.suppressUIUpdates) {
|
||||||
Zotero.debug("Sync is running; not selecting item");
|
Zotero.debug("Sync is running; not selecting item");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no row map, we're probably in the process of switching collections,
|
// If no row map, we're probably in the process of switching collections,
|
||||||
|
|
|
@ -773,7 +773,11 @@ var ZoteroPane = new function()
|
||||||
|
|
||||||
if (manual) {
|
if (manual) {
|
||||||
// Focus the title field
|
// Focus the title field
|
||||||
document.getElementById('zotero-editpane-item-box').focusFirstField();
|
if (this.selectItem(itemID)) {
|
||||||
|
setTimeout(function () {
|
||||||
|
document.getElementById('zotero-editpane-item-box').focusFirstField();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Update most-recently-used list for New Item menu
|
// Update most-recently-used list for New Item menu
|
||||||
this.addItemTypeToNewItemTypeMRU(typeID);
|
this.addItemTypeToNewItemTypeMRU(typeID);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user