diff --git a/chrome/content/zotero/integration/addCitationDialog.js b/chrome/content/zotero/integration/addCitationDialog.js index 55bc8e322..f153b0e3c 100644 --- 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 index c20cde7d3..a8335a5c8 100644 --- 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() {