commit c02baa639d64deb860c4e6769d6f364e4e20729b
parent da45df06cc6bc0e0afb99c3619922f7ab8e91626
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 17 Mar 2016 05:25:49 -0400
Fix word processor integration
Diffstat:
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git 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
@@ -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.