From 0e31e7ca017d5d5b5fe2e42932d21883b5814cff Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Sat, 1 Nov 2014 19:43:41 -0500 Subject: [PATCH] Wait for the item pane to initialize before focusing first field --- chrome/content/zotero/zoteroPane.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 01c6918c8..09c7c28e3 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -1971,6 +1971,7 @@ var ZoteroPane = new function() } var self = this; + var deferred = Zotero.Promise.defer(); this.collectionsView.addEventListener('load', function () { Zotero.spawn(function* () { var currentLibraryID = self.getSelectedLibraryID(); @@ -1993,15 +1994,22 @@ var ZoteroPane = new function() yield self.collectionsView.selectLibrary(item.libraryID); yield self.itemsView.selectItem(itemID, expand); } + deferred.resolve(true); + }) + .catch(function(e) { + deferred.reject(e); }); }); + }) + .catch(function(e) { + deferred.reject(e); }); }); // open Zotero pane this.show(); - return true; + return deferred.promise; });