Fix sidenav button default status
This commit is contained in:
parent
365e97ba1e
commit
b2ce3d4a5c
4 changed files with 49 additions and 22 deletions
|
@ -36,51 +36,61 @@
|
|||
<html:div class="inherit-flex highlight-notes-inactive">
|
||||
<html:div class="pin-wrapper">
|
||||
<toolbarbutton
|
||||
disabled="true"
|
||||
data-l10n-id="sidenav-info"
|
||||
data-pane="info"/>
|
||||
</html:div>
|
||||
<html:div class="pin-wrapper">
|
||||
<toolbarbutton
|
||||
disabled="true"
|
||||
data-l10n-id="sidenav-abstract"
|
||||
data-pane="abstract"/>
|
||||
</html:div>
|
||||
<html:div class="pin-wrapper">
|
||||
<toolbarbutton
|
||||
disabled="true"
|
||||
data-l10n-id="sidenav-attachment-preview"
|
||||
data-pane="attachment-preview"/>
|
||||
</html:div>
|
||||
<html:div class="pin-wrapper">
|
||||
<toolbarbutton
|
||||
disabled="true"
|
||||
data-l10n-id="sidenav-attachments"
|
||||
data-pane="attachments"/>
|
||||
</html:div>
|
||||
<html:div class="pin-wrapper">
|
||||
<toolbarbutton
|
||||
disabled="true"
|
||||
data-l10n-id="sidenav-notes"
|
||||
data-pane="notes"/>
|
||||
</html:div>
|
||||
<html:div class="pin-wrapper">
|
||||
<toolbarbutton
|
||||
disabled="true"
|
||||
data-l10n-id="sidenav-attachment-info"
|
||||
data-pane="attachment-info"/>
|
||||
</html:div>
|
||||
<html:div class="pin-wrapper">
|
||||
<toolbarbutton
|
||||
disabled="true"
|
||||
data-l10n-id="sidenav-attachment-annotations"
|
||||
data-pane="attachment-annotations"/>
|
||||
</html:div>
|
||||
<html:div class="pin-wrapper">
|
||||
<toolbarbutton
|
||||
disabled="true"
|
||||
data-l10n-id="sidenav-libraries-collections"
|
||||
data-pane="libraries-collections"/>
|
||||
</html:div>
|
||||
<html:div class="pin-wrapper">
|
||||
<toolbarbutton
|
||||
disabled="true"
|
||||
data-l10n-id="sidenav-tags"
|
||||
data-pane="tags"/>
|
||||
</html:div>
|
||||
<html:div class="pin-wrapper">
|
||||
<toolbarbutton
|
||||
disabled="true"
|
||||
data-l10n-id="sidenav-related"
|
||||
data-pane="related"/>
|
||||
</html:div>
|
||||
|
@ -416,6 +426,10 @@
|
|||
let pinnedPane = this.pinnedPane;
|
||||
for (let toolbarbutton of this.querySelectorAll('toolbarbutton')) {
|
||||
let pane = toolbarbutton.dataset.pane;
|
||||
// TEMP: never disable context notes button
|
||||
if (this._contextNotesPane) {
|
||||
toolbarbutton.disabled = false;
|
||||
}
|
||||
|
||||
if (pane == 'context-notes') {
|
||||
let hidden = !this._contextNotesPane;
|
||||
|
|
|
@ -1844,12 +1844,20 @@ var ZoteroPane = new function()
|
|||
if (!collectionTreeRow) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
let pane = document.getElementById('zotero-item-pane');
|
||||
let deck = document.getElementById('zotero-item-pane-content');
|
||||
let sidenav = document.getElementById('zotero-view-item-sidenav');
|
||||
|
||||
let hideSidenav = false;
|
||||
|
||||
// Single item selected
|
||||
if (selectedItems.length == 1) {
|
||||
var item = selectedItems[0];
|
||||
sidenav.querySelectorAll('toolbarbutton').forEach(button => button.disabled = false);
|
||||
|
||||
if (item.isNote()) {
|
||||
hideSidenav = true;
|
||||
ZoteroItemPane.onNoteSelected(item, this.collectionsView.editable);
|
||||
}
|
||||
|
||||
|
@ -1857,7 +1865,6 @@ var ZoteroPane = new function()
|
|||
else {
|
||||
var isCommons = collectionTreeRow.isBucket();
|
||||
|
||||
let deck = document.getElementById('zotero-item-pane-content');
|
||||
deck.selectedIndex = 1;
|
||||
|
||||
let pane = ZoteroItemPane.getPinnedPane();
|
||||
|
@ -1890,6 +1897,13 @@ var ZoteroPane = new function()
|
|||
}
|
||||
// Zero or multiple items selected
|
||||
else {
|
||||
let defaultSidenavButtons = [
|
||||
"info", "abstract", "attachments", "notes", "libraries-collections", "tags", "related"
|
||||
];
|
||||
sidenav.querySelectorAll('toolbarbutton').forEach((button) => {
|
||||
button.disabled = true;
|
||||
button.parentElement.hidden = !defaultSidenavButtons.includes(button.dataset.pane);
|
||||
});
|
||||
if (collectionTreeRow.isFeedsOrFeed()) {
|
||||
this.updateReadLabel();
|
||||
}
|
||||
|
@ -1908,7 +1922,7 @@ var ZoteroPane = new function()
|
|||
this.setItemPaneMessage(msg);
|
||||
}
|
||||
else if (count) {
|
||||
document.getElementById('zotero-item-pane-content').selectedIndex = 3;
|
||||
deck.selectedIndex = 3;
|
||||
|
||||
// Load duplicates UI code
|
||||
if (typeof Zotero_Duplicates_Pane == 'undefined') {
|
||||
|
@ -1957,6 +1971,16 @@ var ZoteroPane = new function()
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const sidenavWidth = 37;
|
||||
if (hideSidenav && !sidenav.hidden) {
|
||||
sidenav.hidden = true;
|
||||
pane.width = `${(pane.clientWidth) + sidenavWidth}`;
|
||||
}
|
||||
else if (!hideSidenav && sidenav.hidden) {
|
||||
sidenav.hidden = false;
|
||||
pane.width = `${pane.clientWidth - sidenavWidth}`;
|
||||
}
|
||||
|
||||
return true;
|
||||
}.bind(this))()
|
||||
|
|
|
@ -1180,7 +1180,7 @@
|
|||
</splitter>
|
||||
|
||||
<!-- itemPane.xul -->
|
||||
<vbox id="zotero-item-pane" flex="1" zotero-persist="width height" height="300">
|
||||
<vbox id="zotero-item-pane" flex="0" zotero-persist="width height" height="300">
|
||||
<!-- My Publications -->
|
||||
<hbox id="zotero-item-pane-top-buttons-my-publications" class="zotero-item-pane-top-buttons" hidden="true">
|
||||
<button id="zotero-item-collection-show-hide"/>
|
||||
|
@ -1228,15 +1228,15 @@
|
|||
|
||||
<abstract-box id="zotero-editpane-abstract" class="zotero-editpane-abstract" data-pane="abstract"/>
|
||||
|
||||
<attachment-preview-box id="zotero-editpane-attachment-preview" flex="1" data-pane="attachment-preview"/>
|
||||
<attachment-preview-box id="zotero-editpane-attachment-preview" flex="1" data-pane="attachment-preview" hidden="true"/>
|
||||
|
||||
<attachments-box id="zotero-editpane-attachments" data-pane="attachments"/>
|
||||
|
||||
<notes-box id="zotero-editpane-notes" class="zotero-editpane-notes" data-pane="notes"/>
|
||||
|
||||
<attachment-box id="zotero-attachment-box" flex="1" data-pane="attachment-info" data-use-preview="true"/>
|
||||
<attachment-box id="zotero-attachment-box" flex="1" data-pane="attachment-info" data-use-preview="true" hidden="true"/>
|
||||
|
||||
<attachment-annotations-box id="zotero-editpane-attachment-annotations" flex="1" data-pane="attachment-annotations"/>
|
||||
<attachment-annotations-box id="zotero-editpane-attachment-annotations" flex="1" data-pane="attachment-annotations" hidden="true"/>
|
||||
|
||||
<libraries-collections-box id="zotero-editpane-libraries-collections" class="zotero-editpane-libraries-collections" data-pane="libraries-collections"/>
|
||||
|
||||
|
|
|
@ -68,23 +68,12 @@ item-pane-sidenav {
|
|||
height: 28px;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
flex-shrink: 0;
|
||||
border-radius: 5px;
|
||||
-moz-context-properties: fill, fill-opacity, stroke, stroke-opacity;
|
||||
|
||||
pointer-events: all;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--fill-quinary);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: var(--fill-quarternary);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
background-color: transparent;
|
||||
fill: var(--fill-tertiary);
|
||||
&:disabled,
|
||||
&[disabled="true"] {
|
||||
opacity: 60%;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@each $pane, $color in $item-pane-sections {
|
||||
|
|
Loading…
Reference in a new issue