diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js index d549120b7..5e0ceb092 100644 --- a/chrome/content/zotero/integration/quickFormat.js +++ b/chrome/content/zotero/integration/quickFormat.js @@ -206,7 +206,7 @@ var Zotero_QuickFormat = new function () { /** * Does the dirty work of figuring out what the user meant to type */ - function _quickFormat() { + var _quickFormat = Zotero.Promise.coroutine(function* () { var str = _getEditorContent(); var haveConditions = false; @@ -277,7 +277,7 @@ var Zotero_QuickFormat = new function () { } if(haveConditions) { - var searchResultIDs = (haveConditions ? s.search() : []); + var searchResultIDs = (haveConditions ? (yield s.search()) : []); // Check to see which search results match items already in the document var citedItems, completed = false, isAsync = false; @@ -305,7 +305,7 @@ var Zotero_QuickFormat = new function () { // Generate a string to search for each item let item = citedItems[i]; let itemStr = item.getCreators() - .map(creator => creator.ref.firstName + " " + creator.ref.lastName) + .map(creator => creator.firstName + " " + creator.lastName) .concat([item.getField("title"), item.getField("date", true, true).substr(0, 4)]) .join(" "); @@ -337,7 +337,7 @@ var Zotero_QuickFormat = new function () { // No search conditions, so just clear the box _updateItemList([], [], "", []); } - } + }); /** * Updates currentLocator based on a string diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index cf0485bce..04d7f2371 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -286,7 +286,8 @@ Zotero.Integration = new function() { Zotero.logError(e); } } - }).fin(function() { + }) + .finally(function() { if(document) { try { document.cleanup(); @@ -309,7 +310,7 @@ Zotero.Integration = new function() { } inProgress = Zotero.Integration.currentWindow = false; - }).done(); + }); }; }; @@ -1831,7 +1832,7 @@ Zotero.Integration.CitationEditInterface = function(citation, field, fieldGetter }); var me = this; - this.promise = this._fieldIndexZotero.Promise.then(function(fieldIndex) { + this.promise = this._fieldIndexPromise.then(function(fieldIndex) { me._fieldIndex = fieldIndex; return me._acceptDeferred.promise; }).then(function(progressCallback) { @@ -1872,7 +1873,7 @@ Zotero.Integration.CitationEditInterface.prototype = { */ "_updateSession":function _updateSession(resolveErrors) { var me = this; - if(this._sessionUpdatePromise && this._sessionUpdateZotero.Promise.isFulfilled()) { + if(this._sessionUpdatePromise && this._sessionUpdatePromise.isFulfilled()) { // Session has already been updated. If we were deferring resolving an error, // and we are supposed to resolve it now, then do that if(this._sessionUpdateError) { @@ -1966,7 +1967,7 @@ Zotero.Integration.CitationEditInterface.prototype = { * @return {Promise} A promise resolved by the items */ "getItems":function() { - if(this._fieldIndexZotero.Promise.isFulfilled() + if(this._fieldIndexPromise.isFulfilled() || Zotero.Utilities.isEmpty(this._session.citationsByItemID)) { // Either we already have field data for this run or we have no item data at all. // Update session before continuing.