Proof of concept note view in tab mode

This commit is contained in:
Martynas Bagdonas 2020-09-25 19:44:48 +03:00 committed by Dan Stillman
parent 783f9c50d5
commit 3701b84116
4 changed files with 407 additions and 355 deletions

View file

@ -197,6 +197,9 @@ var Zotero_Tabs = new function () {
this._selectedID = id; this._selectedID = id;
this.deck.selectedIndex = Array.from(this.deck.children).findIndex(x => x.id == id); this.deck.selectedIndex = Array.from(this.deck.children).findIndex(x => x.id == id);
this._update(); this._update();
if (this.onTabSelect) {
this.onTabSelect(tab.type);
}
}; };
/** /**

View file

@ -481,6 +481,22 @@ class ReaderTab extends ReaderInstance {
} }
} }
_toggleNoteSidebar(isToggled) {
let itemPane = this._window.document.getElementById('zotero-item-pane');
var noteEditor = this._window.document.getElementById('zotero-note-editor');
let item = noteEditor.item;
let zp = Zotero.getActiveZoteroPane();
if (itemPane.hidden) {
if (item) {
zp.selectItem(item.id);
itemPane.hidden = false;
}
}
else {
itemPane.hidden = true;
}
}
_setTitleValue(title) { _setTitleValue(title) {
this._window.Zotero_Tabs.rename(this.tabID, title); this._window.Zotero_Tabs.rename(this.tabID, title);
} }

View file

@ -131,6 +131,29 @@ var ZoteroPane = new function()
// continue loading pane // continue loading pane
_loadPane(); _loadPane();
Zotero_Tabs.onTabSelect = (type) => {
let toolbar = document.getElementById('zotero-pane-horizontal-space');
let extendedToolbar = document.getElementById('zotero-reader-toolbar-extension');
let itemPane = document.getElementById('zotero-item-pane');
if (type == 'library') {
toolbar.hidden = false;
extendedToolbar.hidden = true;
itemPane.hidden = false;
}
else {
toolbar.hidden = true;
extendedToolbar.hidden = false;
let items = ZoteroPane_Local.itemsView.getSelectedItems();
if (items.length == 1 && items[0].isNote()) {
itemPane.hidden = false;
}
else {
itemPane.hidden = true;
}
}
}
}; };
/** /**

View file

@ -74,13 +74,8 @@
</commandset> </commandset>
<stack id="zotero-pane-stack"> <stack id="zotero-pane-stack">
<deck id="tabs-deck"> <vbox>
<vbox id="zotero-pane" <vbox id="zotero-pane-horizontal-space">
onkeydown="ZoteroPane_Local.handleKeyDown(event, this.id)"
onkeyup="ZoteroPane_Local.handleKeyUp(event, this.id)"
onkeypress="ZoteroPane_Local.handleKeyPress(event)"
chromedir="&locale.dir;">
<toolbar id="zotero-toolbar" class="toolbar toolbar-primary"> <toolbar id="zotero-toolbar" class="toolbar toolbar-primary">
<hbox id="zotero-collections-toolbar" align="center"> <hbox id="zotero-collections-toolbar" align="center">
<toolbarbutton id="zotero-tb-collection-add" class="zotero-tb-button" tooltiptext="&zotero.toolbar.newCollection.label;" command="cmd_zotero_newCollection"/> <toolbarbutton id="zotero-tb-collection-add" class="zotero-tb-button" tooltiptext="&zotero.toolbar.newCollection.label;" command="cmd_zotero_newCollection"/>
@ -229,7 +224,15 @@
<div id="retracted-items-close">×</div> <div id="retracted-items-close">×</div>
</div> </div>
</vbox> </vbox>
</vbox>
<hbox flex="1">
<deck flex="1" id="tabs-deck">
<vbox id="zotero-pane"
onkeydown="ZoteroPane_Local.handleKeyDown(event, this.id)"
onkeyup="ZoteroPane_Local.handleKeyUp(event, this.id)"
onkeypress="ZoteroPane_Local.handleKeyPress(event)"
chromedir="&locale.dir;">
<popupset> <popupset>
<!-- Allows iframes to show a tooltip popup for nodes with titles. `tooltip="iframeTooltip"` attribute has to be set for the iframe --> <!-- Allows iframes to show a tooltip popup for nodes with titles. `tooltip="iframeTooltip"` attribute has to be set for the iframe -->
<tooltip id="iframeTooltip" onpopupshowing="if (tooltipTitleNode = document.tooltipNode.closest('*[title]')) {this.setAttribute('label', tooltipTitleNode.getAttribute('title')); return true; } return false"/> <tooltip id="iframeTooltip" onpopupshowing="if (tooltipTitleNode = document.tooltipNode.closest('*[title]')) {this.setAttribute('label', tooltipTitleNode.getAttribute('title')); return true; } return false"/>
@ -294,7 +297,8 @@
<menuitem class="menuitem-iconic zotero-menuitem-create-parent" oncommand="ZoteroPane_Local.createParentItemsFromSelected();"/> <menuitem class="menuitem-iconic zotero-menuitem-create-parent" oncommand="ZoteroPane_Local.createParentItemsFromSelected();"/>
<menuitem class="menuitem-iconic zotero-menuitem-rename-from-parent" oncommand="ZoteroPane_Local.renameSelectedAttachmentsFromParents()"/> <menuitem class="menuitem-iconic zotero-menuitem-rename-from-parent" oncommand="ZoteroPane_Local.renameSelectedAttachmentsFromParents()"/>
<menuitem class="menuitem-iconic zotero-menuitem-reindex" oncommand="ZoteroPane_Local.reindexItem();"/> <menuitem class="menuitem-iconic zotero-menuitem-reindex" oncommand="ZoteroPane_Local.reindexItem();"/>
<menuitem class="menuitem-iconic zotero-menuitem-import-annotations" label="&zotero.items.menu.importAnnotations;" oncommand="ZoteroPane.importAnnotationsForSelected()"/> <!-- <menuitem class="menuitem-iconic zotero-menuitem-import-annotations" label="&zotero.items.menu.importAnnotations;" oncommand="ZoteroPane.importAnnotationsForSelected()"/>-->
<menuitem class="menuitem-iconic zotero-menuitem-import-annotations" label="Import annotations" oncommand="ZoteroPane.importAnnotationsForSelected()"/>
</menupopup> </menupopup>
<tooltip id="fake-tooltip"/> <tooltip id="fake-tooltip"/>
@ -562,6 +566,10 @@
ondrop="ZoteroPane.itemsView.onDrop(event); ZoteroPane.itemsView.drop(-1, -1, event.dataTransfer)"/> ondrop="ZoteroPane.itemsView.onDrop(event); ZoteroPane.itemsView.drop(-1, -1, event.dataTransfer)"/>
</deck> </deck>
</vbox> </vbox>
</box>
</hbox>
</vbox>
</deck>
<splitter id="zotero-items-splitter" resizebefore="closest" resizeafter="closest" collapse="after" orient="horizontal" zotero-persist="state orient" <splitter id="zotero-items-splitter" resizebefore="closest" resizeafter="closest" collapse="after" orient="horizontal" zotero-persist="state orient"
onmousemove="ZoteroPane.updateToolbarPosition(); ZoteroPane.updateTagsBoxSize()" onmousemove="ZoteroPane.updateToolbarPosition(); ZoteroPane.updateTagsBoxSize()"
@ -569,12 +577,14 @@
<grippy id="zotero-items-grippy"/> <grippy id="zotero-items-grippy"/>
</splitter> </splitter>
<vbox>
<hbox id="zotero-reader-toolbar-extension" height="32" hidden="true"></hbox>
<!-- itemPane.xul --> <!-- itemPane.xul -->
<vbox id="zotero-item-pane"/> <vbox id="zotero-item-pane"/>
</box> </vbox>
</hbox> </hbox>
</vbox> </vbox>
</deck>
<!-- Barrier to prevent tabbing into Zotero pane when busy --> <!-- Barrier to prevent tabbing into Zotero pane when busy -->
<box id="zotero-pane-tab-catcher-bottom" hidden="true" align="center" pack="center" style="opacity: 0"> <box id="zotero-pane-tab-catcher-bottom" hidden="true" align="center" pack="center" style="opacity: 0">