Fix word processor integration
This commit is contained in:
parent
da45df06cc
commit
c02baa639d
|
@ -206,7 +206,7 @@ var Zotero_QuickFormat = new function () {
|
||||||
/**
|
/**
|
||||||
* Does the dirty work of figuring out what the user meant to type
|
* 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 str = _getEditorContent();
|
||||||
var haveConditions = false;
|
var haveConditions = false;
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ var Zotero_QuickFormat = new function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(haveConditions) {
|
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
|
// Check to see which search results match items already in the document
|
||||||
var citedItems, completed = false, isAsync = false;
|
var citedItems, completed = false, isAsync = false;
|
||||||
|
@ -305,7 +305,7 @@ var Zotero_QuickFormat = new function () {
|
||||||
// Generate a string to search for each item
|
// Generate a string to search for each item
|
||||||
let item = citedItems[i];
|
let item = citedItems[i];
|
||||||
let itemStr = item.getCreators()
|
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)])
|
.concat([item.getField("title"), item.getField("date", true, true).substr(0, 4)])
|
||||||
.join(" ");
|
.join(" ");
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ var Zotero_QuickFormat = new function () {
|
||||||
// No search conditions, so just clear the box
|
// No search conditions, so just clear the box
|
||||||
_updateItemList([], [], "", []);
|
_updateItemList([], [], "", []);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates currentLocator based on a string
|
* Updates currentLocator based on a string
|
||||||
|
|
|
@ -286,7 +286,8 @@ Zotero.Integration = new function() {
|
||||||
Zotero.logError(e);
|
Zotero.logError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).fin(function() {
|
})
|
||||||
|
.finally(function() {
|
||||||
if(document) {
|
if(document) {
|
||||||
try {
|
try {
|
||||||
document.cleanup();
|
document.cleanup();
|
||||||
|
@ -309,7 +310,7 @@ Zotero.Integration = new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
inProgress = Zotero.Integration.currentWindow = false;
|
inProgress = Zotero.Integration.currentWindow = false;
|
||||||
}).done();
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1831,7 +1832,7 @@ Zotero.Integration.CitationEditInterface = function(citation, field, fieldGetter
|
||||||
});
|
});
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
this.promise = this._fieldIndexZotero.Promise.then(function(fieldIndex) {
|
this.promise = this._fieldIndexPromise.then(function(fieldIndex) {
|
||||||
me._fieldIndex = fieldIndex;
|
me._fieldIndex = fieldIndex;
|
||||||
return me._acceptDeferred.promise;
|
return me._acceptDeferred.promise;
|
||||||
}).then(function(progressCallback) {
|
}).then(function(progressCallback) {
|
||||||
|
@ -1872,7 +1873,7 @@ Zotero.Integration.CitationEditInterface.prototype = {
|
||||||
*/
|
*/
|
||||||
"_updateSession":function _updateSession(resolveErrors) {
|
"_updateSession":function _updateSession(resolveErrors) {
|
||||||
var me = this;
|
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,
|
// Session has already been updated. If we were deferring resolving an error,
|
||||||
// and we are supposed to resolve it now, then do that
|
// and we are supposed to resolve it now, then do that
|
||||||
if(this._sessionUpdateError) {
|
if(this._sessionUpdateError) {
|
||||||
|
@ -1966,7 +1967,7 @@ Zotero.Integration.CitationEditInterface.prototype = {
|
||||||
* @return {Promise} A promise resolved by the items
|
* @return {Promise} A promise resolved by the items
|
||||||
*/
|
*/
|
||||||
"getItems":function() {
|
"getItems":function() {
|
||||||
if(this._fieldIndexZotero.Promise.isFulfilled()
|
if(this._fieldIndexPromise.isFulfilled()
|
||||||
|| Zotero.Utilities.isEmpty(this._session.citationsByItemID)) {
|
|| Zotero.Utilities.isEmpty(this._session.citationsByItemID)) {
|
||||||
// Either we already have field data for this run or we have no item data at all.
|
// Either we already have field data for this run or we have no item data at all.
|
||||||
// Update session before continuing.
|
// Update session before continuing.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user