zotero: implement citation refresh

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Id91acbed6c651dfed02777d7fa4142edf597a55a
This commit is contained in:
Pranam Lashkari 2023-01-04 00:47:18 +05:30 committed by Andras Timar
parent 46d1f930de
commit 383b6a7080
3 changed files with 15 additions and 8 deletions

View file

@ -1843,14 +1843,8 @@ L.Control.Menubar = L.Control.extend({
this._map.sendUnoCommand('.uno:LOKSidebarWriterPage');
this._map.fire('showwizardsidebar', {noRefresh: true});
window.pageMobileWizard = true;
} else if (id === 'zoteroaddeditbibliography') {
this._map.dispatch('zoteroaddeditbibliography');
} else if (id === 'zoteroaddeditcitation') {
this._map.dispatch('zoteroaddeditcitation');
} else if (id === 'zoterosetdocprefs') {
this._map.dispatch('zoterosetdocprefs');
} else if (id === 'zoteroaddnote') {
this._map.dispatch('zoteroaddnote');
} else if (id.startsWith('zotero')) {
this._map.dispatch(id);
}
// Inform the host if asked
if (postmessage)

View file

@ -966,6 +966,14 @@ L.Control.Zotero = L.Control.extend({
});
},
refreshCitations: function() {
//discard the cached url and fetch fresh one
var refreshURL = 'https://api.zotero.org/users/' + this.userID + '/items/top' + this.getZoteroItemQuery() + '&itemKey=' + this.getCitationKeys().join(',');
if (this._cachedURL[refreshURL])
delete this._cachedURL[refreshURL];
this.updateCitations();
},
_onMessage: function(message) {
if (message.startsWith('itemslist: ')) {
this.handleItemList(message);

View file

@ -875,6 +875,11 @@ L.Map.include({
this.zotero.handleInsertNote();
}
break;
case 'zoterorefresh':
{
this.zotero.refreshCitations();
}
break;
case 'exportpdf':
{
this.sendUnoCommand('.uno:ExportToPDF', {