commit a605fe1cff332b5f39047e86d368b28de93f44e1
parent 7bc80d1f32f029fb2985420897b92a0de939a2c5
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 25 Apr 2016 00:33:57 -0400
Don't try to access itemsView until loaded in citation dialogs
Diffstat:
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/integration/addCitationDialog.js b/chrome/content/zotero/integration/addCitationDialog.js
@@ -664,7 +664,9 @@ var Zotero_Citation_Dialog = new function () {
_multipleSourceButton.disabled = false;
}
} else {
- _acceptButton.disabled = !itemsView.getSelectedItems().length; // treeview from xpcom/itemTreeView.js
+ collectionsView.addEventListener('load', () => {
+ _acceptButton.disabled = !itemsView.getSelectedItems().length;
+ });
}
}
diff --git a/chrome/content/zotero/selectItemsDialog.js b/chrome/content/zotero/selectItemsDialog.js
@@ -32,8 +32,7 @@ var io;
* io - used for input/output (dataOut is list of item IDs)
* sourcesOnly - whether only sources should be shown in the window
*/
-function doLoad()
-{
+var doLoad = Zotero.Promise.coroutine(function* () {
// Set font size from pref
var sbc = document.getElementById('zotero-select-items-container');
Zotero.setFontSize(sbc);
@@ -47,10 +46,15 @@ function doLoad()
// Don't show Commons when citing
collectionsView.hideSources = ['duplicates', 'trash', 'feeds'];
document.getElementById('zotero-collections-tree').view = collectionsView;
+
+ var deferred = Zotero.Promise.defer();
+ collectionsView.addEventListener('load', () => deferred.resolve());
+ yield deferred.promise;
+
if(io.select) itemsView.selectItem(io.select);
Zotero.updateQuickSearchBox(document);
-}
+});
function doUnload()
{