Introducing Zotero tab

- Prefer to show zotero related actions within a dedicated tab (instead
of adding those within references tab as it was previously). This,
hopefully is more familiar to user using similar interface elsewhere
- Show this new tab conditionally (if zotero is enabled)

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: I1690295724d54693aca68ade567e9d1076f26876
This commit is contained in:
Pedro Pinto Silva 2022-12-07 17:52:24 +01:00 committed by pedropintosilva
parent 0321254443
commit 431ba6206f

View file

@ -7,7 +7,7 @@
L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({ L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({
getTabs: function() { getTabs: function() {
return [ var tabs = [
{ {
'text': _('~File'), 'text': _('~File'),
'id': '-1', 'id': '-1',
@ -34,6 +34,17 @@ L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({
'id': '-6', 'id': '-6',
'name': 'References' 'name': 'References'
}, },
];
if (this._map.zotero && this._map.zotero.enable) {
tabs.push(
{
'text': _('Zotero'),
'id': 'zotero',
'name': 'Zotero',
}
);
}
tabs.push(
{ {
'text': _('~Review'), 'text': _('~Review'),
'id': '-7', 'id': '-7',
@ -71,25 +82,31 @@ L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({
'id': '-2', 'id': '-2',
'name': 'Help', 'name': 'Help',
} }
]; );
return tabs;
}, },
getFullJSON: function(selectedId) { getFullJSON: function(selectedId) {
return this.getNotebookbar( var tabPages = [
[ this.getFileTab(),
this.getFileTab(), this.getHomeTab(),
this.getHomeTab(), this.getInsertTab(),
this.getInsertTab(), this.getLayoutTab(),
this.getLayoutTab(), this.getReferencesTab()
this.getReferencesTab(), ];
this.getReviewTab(), if (this._map.zotero && this._map.zotero.enable) {
this.getFormatTab(), tabPages.push(this.getZoteroTab());
this.getFormTab(), }
this.getTableTab(), tabPages.push(
this.getDrawTab(), this.getReviewTab(),
this.getViewTab(), this.getFormatTab(),
this.getHelpTab() this.getFormTab(),
], selectedId); this.getTableTab(),
this.getDrawTab(),
this.getViewTab(),
this.getHelpTab()
);
return this.getNotebookbar(tabPages, selectedId);
}, },
getFileTab: function() { getFileTab: function() {
@ -1501,27 +1518,29 @@ L.Control.NotebookbarWriter = L.Control.Notebookbar.extend({
} }
]; ];
if (this._map.zotero && this._map.zotero.enable) {
content.push(
{
'id': 'zoteroedit',
'type': 'bigmenubartoolitem',
'text': _('Add/Edit Citation'),
'command': 'zoteroEdit'
},
{
'id': 'zoterostyle',
'type': 'bigmenubartoolitem',
'text': _('Citation Style'),
'command': 'zoteroStyle'
}
);
}
return this.getTabPage('References', content); return this.getTabPage('References', content);
}, },
getReviewTab: function() { getZoteroTab: function() {
var content = [
{
'id': 'zoteroedit',
'type': 'bigmenubartoolitem',
'text': _('Add/Edit Citation'),
'command': 'zoteroEdit'
},
{
'id': 'zoterostyle',
'type': 'bigmenubartoolitem',
'text': _('Citation Style'),
'command': 'zoteroStyle'
}
];
return this.getTabPage('Zotero', content);
},
getReviewTab: function() {
var content = [ var content = [
{ {
'type': 'bigtoolitem', 'type': 'bigtoolitem',