Add addEditCitation command to Zotero

This commit is contained in:
Simon Kornblith 2015-09-24 23:44:19 -04:00
parent ec66d15a5f
commit 974a07bf73

View file

@ -1050,7 +1050,7 @@ Zotero.Integration.Document.prototype.addCitation = function() {
Zotero.Integration.Document.prototype.editCitation = function() {
var me = this;
return this._getSession(true, false).then(function() {
var field = me._doc.cursorInField(me._session.data.prefs['fieldType'])
var field = me._doc.cursorInField(me._session.data.prefs['fieldType']);
if(!field) {
throw new Zotero.Exception.Alert("integration.error.notInCitation", [],
"integration.error.title");
@ -1060,6 +1060,18 @@ Zotero.Integration.Document.prototype.editCitation = function() {
});
}
/**
* Edits the citation at the cursor position if one exists, or else adds a new one.
* @return {Promise}
*/
Zotero.Integration.Document.prototype.addEditCitation = function() {
var me = this;
return this._getSession(false, false).then(function() {
var field = me._doc.cursorInField(me._session.data.prefs['fieldType']);
return (new Zotero.Integration.Fields(me._session, me._doc)).addEditCitation(field);
});
}
/**
* Adds a bibliography to the current document.
* @return {Promise}