www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 974a07bf73370eeac43847c211fd9f652935b817
parent ec66d15a5f3eea79a6946c42ef2ef9017ad40c31
Author: Simon Kornblith <simon@simonster.com>
Date:   Thu, 24 Sep 2015 23:44:19 -0400

Add addEditCitation command to Zotero

Diffstat:
Mchrome/content/zotero/xpcom/integration.js | 16++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js @@ -1042,7 +1042,7 @@ Zotero.Integration.Document.prototype.addCitation = function() { return (new Zotero.Integration.Fields(me._session, me._doc)).addEditCitation(null); }); } - + /** * Edits the citation at the cursor position. * @return {Promise} @@ -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"); @@ -1061,6 +1061,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} */