From 9c9b8b835d5a81b3c94f466d3cc47a602522d817 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 10 Oct 2014 16:01:09 -0400 Subject: [PATCH] Fix crash when dragging items to collections from advanced search window (Dragging to the items list is still disabled.) --- chrome/content/zotero/advancedSearch.js | 7 ++++++- chrome/content/zotero/xpcom/zotero.js | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/advancedSearch.js b/chrome/content/zotero/advancedSearch.js index 4bb5cefe7..896829686 100644 --- a/chrome/content/zotero/advancedSearch.js +++ b/chrome/content/zotero/advancedSearch.js @@ -35,6 +35,7 @@ var ZoteroAdvancedSearch = new function() { this.itemsView = false; var _searchBox; + var _libraryID; function onLoad() { _searchBox = document.getElementById('zotero-search-box'); @@ -53,8 +54,11 @@ var ZoteroAdvancedSearch = new function() { _searchBox.updateSearch(); _searchBox.active = true; - // A minimal implementation of Zotero.CollectionTreeView + // A minimal implementation of Zotero.ItemGroup var itemGroup = { + ref: { + libraryID: _libraryID + }, isSearchMode: function() { return true; }, getItems: function () { var search = _searchBox.search.clone(); @@ -147,6 +151,7 @@ var ZoteroAdvancedSearch = new function() { this.onLibraryChange = function (libraryID) { + _libraryID = libraryID; document.getElementById('zotero-search-save').disabled = !Zotero.Libraries.isEditable(libraryID); } diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index f1c38d93e..9303b3282 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -2672,6 +2672,9 @@ Zotero.DragDrop = { return false; } var win = sourceNode.ownerDocument.defaultView; + if (win.document.documentElement.getAttribute('windowtype') == 'zotero:search') { + return win.ZoteroAdvancedSearch.itemsView.itemGroup; + } return win.ZoteroPane.collectionsView.itemGroup; } else {