Experiment with the new item pane UI
This commit is contained in:
parent
36cc18e8cf
commit
bb5075e8b8
19 changed files with 742 additions and 448 deletions
|
@ -1,10 +1,10 @@
|
|||
/* Use standard tab appearance for item pane tabs */
|
||||
#zotero-pane #zotero-view-tabbox > tabs > tab {
|
||||
#zotero-pane .zotero-view-tabbox > tabs > tab {
|
||||
-moz-appearance: tab;
|
||||
}
|
||||
|
||||
/* Active tab label color in item pane and elsewhere */
|
||||
#zotero-pane tabs#zotero-editpane-tabs > tab[visuallyselected="true"][selected="true"] hbox > .tab-text,
|
||||
#zotero-pane tabs.zotero-editpane-tabs > tab[visuallyselected="true"][selected="true"] hbox > .tab-text,
|
||||
#zotero-prefs tab[visuallyselected="true"]:not(:-moz-window-inactive),
|
||||
tabs > tab[visuallyselected="true"] hbox > .tab-text {
|
||||
color: black !important;
|
||||
|
|
|
@ -107,12 +107,12 @@ input {
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
#zotero-view-tabbox {
|
||||
.zotero-view-tabbox {
|
||||
background-color: #fff;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#zotero-item-pane-content .groupbox-body {
|
||||
.zotero-item-pane-content .groupbox-body {
|
||||
-moz-appearance: none;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
@ -121,13 +121,13 @@ input {
|
|||
color: #7f7f7f;
|
||||
}
|
||||
|
||||
#zotero-view-tabbox > tabpanels {
|
||||
.zotero-view-tabbox > tabpanels {
|
||||
margin: 12px 0 0 0;
|
||||
padding: 0;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
|
||||
#zotero-editpane-tabs {
|
||||
.zotero-editpane-tabs {
|
||||
-moz-appearance: none;
|
||||
background: -moz-linear-gradient(top, #ededed, #cccccc);
|
||||
border-style: solid;
|
||||
|
@ -136,15 +136,15 @@ input {
|
|||
padding: 2px 0 2px 0;
|
||||
}
|
||||
|
||||
#zotero-editpane-tabs > tab > hbox {
|
||||
.zotero-editpane-tabs > tab > hbox {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#zotero-editpane-tabs > tab > hbox > .tab-icon {
|
||||
.zotero-editpane-tabs > tab > hbox > .tab-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#zotero-editpane-tabs > tab {
|
||||
.zotero-editpane-tabs > tab {
|
||||
-moz-box-orient: vertical;
|
||||
-moz-box-align: center;
|
||||
-moz-appearance: toolbarbutton;
|
||||
|
@ -153,7 +153,7 @@ input {
|
|||
padding: 3px 1px 3px 1px;
|
||||
}
|
||||
|
||||
#zotero-editpane-tabs > tab > hbox .tab-text {
|
||||
.zotero-editpane-tabs > tab > hbox .tab-text {
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
margin: 2px 7px 2px 9px !important;
|
||||
|
@ -161,11 +161,11 @@ input {
|
|||
}
|
||||
|
||||
/* This seems to be necessary to center the tabs. Not sure why. */
|
||||
#zotero-editpane-tabs > tab:last-of-type > hbox .tab-text {
|
||||
.zotero-editpane-tabs > tab:last-of-type > hbox .tab-text {
|
||||
margin: 2px 9px 2px 9px !important;
|
||||
}
|
||||
|
||||
#zotero-editpane-tabs > tab[selected=true] > hbox .tab-text {
|
||||
.zotero-editpane-tabs > tab[selected=true] > hbox .tab-text {
|
||||
color: #FFF !important;
|
||||
text-shadow: rgba(0, 0, 0, 0.4) 0 1px;
|
||||
}
|
||||
|
|
|
@ -11,20 +11,20 @@
|
|||
visibility: visible;
|
||||
}
|
||||
|
||||
#zotero-item-pane-content {
|
||||
.zotero-item-pane-content {
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
/* Make the item pane appear white (same colour as treeview), making the UI more consistent */
|
||||
#zotero-item-pane-content tab, #zotero-item-pane-content tabpanels {
|
||||
.zotero-item-pane-content tab, .zotero-item-pane-content tabpanels {
|
||||
background-color: -moz-Field; /* Same as background colour for treeview */
|
||||
}
|
||||
|
||||
/* Possibly irrelevant if mozilla fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1306425 */
|
||||
#zotero-view-tabbox tabs tab[visuallyselected=true] {
|
||||
.zotero-view-tabbox tabs tab[visuallyselected=true] {
|
||||
margin-top: 0px !important; /* Importanter than ./itemPane.css:20 */
|
||||
margin-bottom: -2px !important; /* Importanter than skin/itemPane.css:12 */
|
||||
}
|
||||
#zotero-view-tabbox tabs tab {
|
||||
.zotero-view-tabbox tabs tab {
|
||||
margin-top: 2px !important; /* Importanter than skin/itemPane.css:11 */
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
padding-top: 4px;
|
||||
}
|
||||
|
||||
#zotero-view-tabbox tab {
|
||||
.zotero-view-tabbox tab {
|
||||
padding-left: .7em;
|
||||
padding-right: .7em;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
#zotero-collections-tree, #zotero-items-tree, #zotero-view-item {
|
||||
#zotero-collections-tree, #zotero-items-tree, .zotero-view-item {
|
||||
-moz-appearance: none;
|
||||
border-style: solid;
|
||||
border-color: #818790;
|
||||
|
@ -142,11 +142,11 @@ tree {
|
|||
margin: .04em 0 0 .15em !important;
|
||||
}
|
||||
|
||||
#zotero-editpane-tabs spacer {
|
||||
.zotero-editpane-tabs spacer {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
#zotero-view-item {
|
||||
.zotero-view-item {
|
||||
padding: 0 !important;
|
||||
-moz-appearance: none;
|
||||
background-color: -moz-field;
|
||||
|
@ -154,7 +154,7 @@ tree {
|
|||
border-color: var(--theme-border-color);
|
||||
}
|
||||
|
||||
#zotero-editpane-tabs {
|
||||
.zotero-editpane-tabs {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
|
@ -163,8 +163,8 @@ tree {
|
|||
border-width: 0;
|
||||
}
|
||||
|
||||
#zotero-editpane-item-box > scrollbox, #zotero-view-item > tabpanel > vbox,
|
||||
#zotero-editpane-tags > scrollbox, #zotero-editpane-related {
|
||||
.zotero-editpane-item-box > scrollbox, .zotero-view-item > tabpanel > vbox,
|
||||
#zotero-editpane-tags > scrollbox, .zotero-editpane-related {
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
|
@ -172,6 +172,6 @@ tree {
|
|||
padding-left: 5px;
|
||||
}
|
||||
|
||||
#zotero-view-item > tabpanel > vbox {
|
||||
.zotero-view-item > tabpanel > vbox {
|
||||
padding-left: 5px;
|
||||
}
|
54
chrome/content/zotero/components/itemPane/notesList.jsx
Normal file
54
chrome/content/zotero/components/itemPane/notesList.jsx
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright © 2020 Corporation for Digital Scholarship
|
||||
Vienna, Virginia, USA
|
||||
https://www.zotero.org
|
||||
|
||||
This file is part of Zotero.
|
||||
|
||||
Zotero is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Zotero is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
import React, { forwardRef, useImperativeHandle, useState } from 'react';
|
||||
|
||||
const NoteRow = ({ title, body, date, onClick }) => {
|
||||
return (
|
||||
<div className="note-row" onClick={onClick}>
|
||||
<div className="inner">
|
||||
<div className="first-line">
|
||||
<div className="title">{title}</div>
|
||||
</div>
|
||||
<div className="second-line">
|
||||
<div className="date">{date}</div>
|
||||
<div className="body">{body}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const NotesList = forwardRef(({ onClick }, ref) => {
|
||||
const [notes, setNotes] = useState([]);
|
||||
useImperativeHandle(ref, () => ({ setNotes }));
|
||||
return (
|
||||
<div className="notes-list">
|
||||
{notes.map(note => <NoteRow key={note.id} {...note} onClick={() => onClick(note.id)}/>)}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default NotesList;
|
|
@ -26,13 +26,15 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import TagsBoxContainer from 'containers/tagsBoxContainer';
|
||||
import NotesList from 'components/itemPane/notesList';
|
||||
|
||||
var ZoteroItemPane = new function() {
|
||||
var _lastItem, _itemBox, _notesLabel, _notesButton, _notesList, _tagsBox, _relatedBox;
|
||||
var _selectedNoteID;
|
||||
var _translationTarget;
|
||||
var _noteIDs;
|
||||
var _recentlyPinned = [];
|
||||
var _contextNoteUpdaters = [];
|
||||
let _pdfTabHidden = false;
|
||||
|
||||
this.onLoad = function () {
|
||||
if (!Zotero) {
|
||||
|
@ -64,7 +66,7 @@ var ZoteroItemPane = new function() {
|
|||
document.getElementById('temp-toggle-2').addEventListener('click', () => {
|
||||
this.togglePane();
|
||||
});
|
||||
this.initPinnedView();
|
||||
this.initStandaloneNotesView();
|
||||
}
|
||||
|
||||
|
||||
|
@ -234,6 +236,10 @@ var ZoteroItemPane = new function() {
|
|||
yield this.viewItem(_lastItem, null, 1);
|
||||
}
|
||||
}
|
||||
this.updateStandaloneNotesList();
|
||||
for (let updater of _contextNoteUpdaters) {
|
||||
updater.callback();
|
||||
}
|
||||
}
|
||||
else if (type == 'tab') {
|
||||
if (action == 'add') {
|
||||
|
@ -301,6 +307,7 @@ var ZoteroItemPane = new function() {
|
|||
// noteEditor.clearUndo();
|
||||
// }
|
||||
|
||||
document.getElementById('zotero-view-note-sidebar-button').hidden = !!item.parentID;
|
||||
document.getElementById('zotero-view-note-button').hidden = !editable;
|
||||
document.getElementById('zotero-item-pane-content').selectedIndex = 2;
|
||||
};
|
||||
|
@ -310,6 +317,17 @@ var ZoteroItemPane = new function() {
|
|||
// ZoteroPane.setItemPaneMessage(Zotero.getString('pane.item.notes.editingInWindow'));
|
||||
};
|
||||
|
||||
this.openNoteSidebar = async function () {
|
||||
var selectedNote = Zotero.Items.get(_selectedNoteID);
|
||||
|
||||
if (!selectedNote.parentID) {
|
||||
let editor = document.getElementById('zotero-item-pane-pinned-note');
|
||||
editor.mode = 'edit';
|
||||
editor.item = selectedNote;
|
||||
document.getElementById('zotero-item-pane-pin-deck2').setAttribute('selectedIndex', 1);
|
||||
this.togglePane(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the parent item and open the note editor
|
||||
|
@ -457,6 +475,26 @@ var ZoteroItemPane = new function() {
|
|||
elem.setAttribute('tooltiptext', tooltip);
|
||||
};
|
||||
|
||||
|
||||
function _updateNoteCount() {
|
||||
var c = _notesList.childNodes.length;
|
||||
|
||||
var str = 'pane.item.notes.count.';
|
||||
switch (c){
|
||||
case 0:
|
||||
str += 'zero';
|
||||
break;
|
||||
case 1:
|
||||
str += 'singular';
|
||||
break;
|
||||
default:
|
||||
str += 'plural';
|
||||
break;
|
||||
}
|
||||
|
||||
_notesLabel.value = Zotero.getString(str, [c]);
|
||||
}
|
||||
|
||||
this.getActiveNote = function () {
|
||||
let mainDeck = document.getElementById('zotero-item-pane-main-deck');
|
||||
if (mainDeck.selectedIndex == 0) {
|
||||
|
@ -477,18 +515,6 @@ var ZoteroItemPane = new function() {
|
|||
return null;
|
||||
}
|
||||
|
||||
window.addEventListener('mousedown', () => {
|
||||
Zotero.debug('active note')
|
||||
Zotero.debug(this.getActiveNote())
|
||||
});
|
||||
|
||||
this.pinNote = function(itemID) {
|
||||
_recentlyPinned.unshift(itemID);
|
||||
_recentlyPinned = _recentlyPinned.slice(0, 10);
|
||||
this._setPinnedNote(itemID);
|
||||
this._updatePinnedList();
|
||||
}
|
||||
|
||||
this.togglePane = function (forceItem) {
|
||||
let mainDeck = document.getElementById('zotero-item-pane-main-deck');
|
||||
let value;
|
||||
|
@ -511,11 +537,12 @@ var ZoteroItemPane = new function() {
|
|||
}
|
||||
|
||||
mainDeck.selectedIndex = value;
|
||||
|
||||
let contextualDeck = document.getElementById('zotero-item-pane-contextual-deck');
|
||||
contextualDeck.children[contextualDeck.selectedIndex].setAttribute('state', value);
|
||||
}
|
||||
|
||||
this.initPinnedView = async function () {
|
||||
|
||||
|
||||
this.initStandaloneNotesView = async function () {
|
||||
let container = document.getElementById('zotero-item-pane-pin-deck');
|
||||
|
||||
let bar = document.createElement('hbox');
|
||||
|
@ -529,26 +556,23 @@ var ZoteroItemPane = new function() {
|
|||
let returnButton = document.createElement('toolbarbutton');
|
||||
returnButton.className = 'zotero-tb-button';
|
||||
returnButton.id = 'zotero-tb-return';
|
||||
returnButton.style.listStyleImage = "url('chrome://zotero/skin/citation-delete.png')"
|
||||
returnButton.style.listStyleImage = 'url(\'chrome://zotero/skin/citation-delete.png\')'
|
||||
returnButton.addEventListener('click', () => {
|
||||
inner.setAttribute('selectedIndex', 0);
|
||||
});
|
||||
|
||||
|
||||
bar.append(returnButton, 'Pinned note');
|
||||
bar.append(returnButton, 'Standalone Notes');
|
||||
bar.style.overflowX = 'hidden';
|
||||
bar.style.textOverflow = 'ellipsis';
|
||||
bar.style.fontWeight = 'bold';
|
||||
|
||||
|
||||
|
||||
let list = document.createElement('vbox');
|
||||
list.setAttribute('flex', 1);
|
||||
list.className = 'zotero-box';
|
||||
|
||||
|
||||
|
||||
|
||||
let note = document.createElement('zoteronoteeditor');
|
||||
note.id = 'zotero-item-pane-pinned-note';
|
||||
note.setAttribute('flex', 1);
|
||||
|
@ -559,51 +583,72 @@ var ZoteroItemPane = new function() {
|
|||
|
||||
|
||||
let head = document.createElement('hbox');
|
||||
head.setAttribute('align', 'center');
|
||||
let label = document.createElement('label');
|
||||
let button = document.createElement('button');
|
||||
button.setAttribute('label', 'Add');
|
||||
button.setAttribute('label', Zotero.Intl.strings['zotero.item.add']);
|
||||
button.addEventListener('click', async () => {
|
||||
inner.setAttribute('selectedIndex', 1);
|
||||
let item = new Zotero.Item('note');
|
||||
item.libraryID = parentItem.libraryID;
|
||||
item.parentKey = parentItem.key;
|
||||
item.libraryID = ZoteroPane_Local.getSelectedLibraryID();
|
||||
// item.parentKey = parentItem.key;
|
||||
note.mode = 'edit';
|
||||
note.item = item;
|
||||
note.parentItem = null;
|
||||
note.focus();
|
||||
});
|
||||
head.append(label, button);
|
||||
|
||||
let grid = document.createElement('grid');
|
||||
grid.setAttribute('flex', 1);
|
||||
grid.style.overflowY = 'scroll';
|
||||
let columns = document.createElement('columns');
|
||||
let column1 = document.createElement('column');
|
||||
column1.setAttribute('flex', 1);
|
||||
let column2 = document.createElement('column');
|
||||
columns.append(column1, column2);
|
||||
grid.append(columns);
|
||||
let rows = document.createElement('rows');
|
||||
rows.setAttribute('flex', 1);
|
||||
rows.id = 'zotero-item-pane-pinned-list';
|
||||
grid.append(rows);
|
||||
head.style.paddingRight = '10px';
|
||||
|
||||
list.append(head, grid);
|
||||
|
||||
this._updatePinnedList();
|
||||
}
|
||||
|
||||
this._updatePinnedList = async function() {
|
||||
let rows = document.getElementById('zotero-item-pane-pinned-list');
|
||||
while (rows.hasChildNodes()) {
|
||||
rows.removeChild(rows.firstChild);
|
||||
let input = document.createElement('textbox');
|
||||
input.setAttribute('type', 'search');
|
||||
input.setAttribute('timeout', '250');
|
||||
|
||||
input.addEventListener('command', (event) => {
|
||||
_updateStandaloneNotesList();
|
||||
})
|
||||
|
||||
|
||||
let vbox1 = document.createElement('vbox');
|
||||
vbox1.append(label, button);
|
||||
|
||||
let vbox2 = document.createElement('vbox');
|
||||
vbox2.append(input);
|
||||
|
||||
head.append(vbox2, vbox1);
|
||||
|
||||
head.style.display = 'flex';
|
||||
vbox2.style.flex = '1';
|
||||
|
||||
|
||||
let listBox = document.createElement('vbox');
|
||||
listBox.style.display = 'flex';
|
||||
listBox.setAttribute('flex', '1')
|
||||
|
||||
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
||||
var listInner = document.createElementNS(HTML_NS, 'div');
|
||||
listInner.className = 'notes-list-container';
|
||||
list.append(head, listBox);
|
||||
|
||||
listBox.append(listInner);
|
||||
|
||||
let noteListRef = React.createRef();
|
||||
|
||||
let _updateStandaloneNotesList = async (reset) => {
|
||||
if (reset) {
|
||||
input.value = '';
|
||||
inner.setAttribute('selectedIndex', 0);
|
||||
}
|
||||
let text = input.value;
|
||||
|
||||
await Zotero.Schema.schemaUpdatePromise;
|
||||
var s = new Zotero.Search();
|
||||
s.addCondition('libraryID', 'is', 1);
|
||||
s.addCondition('libraryID', 'is', ZoteroPane_Local.getSelectedLibraryID());
|
||||
s.addCondition('itemType', 'is', 'note');
|
||||
s.addCondition('noChildren', 'true');
|
||||
if (text) {
|
||||
s.addCondition('note', 'contains', text, true);
|
||||
}
|
||||
let notes = await s.search();
|
||||
notes = Zotero.Items.get(notes);
|
||||
notes.sort((a, b) => {
|
||||
|
@ -612,22 +657,40 @@ var ZoteroItemPane = new function() {
|
|||
return b.localeCompare(a);
|
||||
});
|
||||
|
||||
var row = document.createElement('row');
|
||||
row.style.fontWeight = 'bold';
|
||||
row.appendChild(document.createTextNode('Recently pinned notes'));
|
||||
rows.append(row);
|
||||
this._appendNoteRows(Zotero.Items.get(_recentlyPinned), rows, false, (id) => {
|
||||
this._setPinnedNote(id);
|
||||
});
|
||||
noteListRef.current.setNotes(notes.map(note => {
|
||||
let text2 = note.note;
|
||||
text2 = text2.trim();
|
||||
// TODO: Fix a potential performance issuse
|
||||
text2 = Zotero.Utilities.unescapeHTML(text2);
|
||||
let parts = text2.split('\n').map(x => x.trim()).filter(x => x.length);
|
||||
return {
|
||||
id: note.id,
|
||||
title: parts[0] || Zotero.getString('pane.item.notes.untitled'),
|
||||
body: parts[1] || '',
|
||||
date: (new Date(note.dateModified).toLocaleDateString(Zotero.locale))
|
||||
};
|
||||
}));
|
||||
|
||||
row = document.createElement('row');
|
||||
row.style.fontWeight = 'bold';
|
||||
row.appendChild(document.createTextNode('Recently edited standalone notes'));
|
||||
rows.append(row);
|
||||
var c = notes.length;
|
||||
var str = 'pane.item.notes.count.' + (c == 0 && 'zero' || c == 1 && 'singular' || 'plural');
|
||||
label.value = Zotero.getString(str, [c]);
|
||||
}
|
||||
|
||||
this._appendNoteRows(notes, rows, false, (id) => {
|
||||
ReactDOM.render(
|
||||
<NotesList
|
||||
ref={noteListRef}
|
||||
onClick={(id) => {
|
||||
this._setPinnedNote(id);
|
||||
});
|
||||
}}
|
||||
/>,
|
||||
listInner,
|
||||
() => {
|
||||
_updateStandaloneNotesList();
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
this.updateStandaloneNotesList = _updateStandaloneNotesList;
|
||||
}
|
||||
|
||||
this._setPinnedNote = function (itemID) {
|
||||
|
@ -684,131 +747,24 @@ var ZoteroItemPane = new function() {
|
|||
}
|
||||
}
|
||||
|
||||
this.addPDFTabContext = function(tabID, itemID) {
|
||||
let contextualDeck = document.getElementById('zotero-item-pane-contextual-deck');
|
||||
|
||||
let container = document.createElement('vbox');
|
||||
container.id = tabID + '-context';
|
||||
|
||||
let bar = document.createElement('hbox');
|
||||
container.appendChild(bar);
|
||||
let inner = document.createElement('deck');
|
||||
inner.style.backgroundColor = 'white';
|
||||
inner.setAttribute('flex', 1);
|
||||
container.appendChild(inner);
|
||||
|
||||
contextualDeck.appendChild(container);
|
||||
|
||||
let item = Zotero.Items.get(itemID);
|
||||
if (!item.parentID) {
|
||||
inner.append("The PDF doesn't have a parent");
|
||||
return;
|
||||
}
|
||||
|
||||
let parentItem = Zotero.Items.get(item.parentID);
|
||||
let returnButton = document.createElement('toolbarbutton');
|
||||
returnButton.className = 'zotero-tb-button';
|
||||
returnButton.id = 'zotero-tb-return';
|
||||
returnButton.style.listStyleImage = "url('chrome://zotero/skin/citation-delete.png')"
|
||||
returnButton.addEventListener('click', () => {
|
||||
inner.setAttribute('selectedIndex', 0);
|
||||
});
|
||||
|
||||
bar.append(returnButton, parentItem.getField('title'));
|
||||
bar.style.overflowX = 'hidden';
|
||||
bar.style.textOverflow = 'ellipsis';
|
||||
bar.style.fontWeight = 'bold';
|
||||
|
||||
let list = document.createElement('vbox');
|
||||
list.setAttribute('flex', 1);
|
||||
list.className = 'zotero-box';
|
||||
|
||||
let note = document.createElement('zoteronoteeditor');
|
||||
note.setAttribute('flex', 1);
|
||||
inner.appendChild(list);
|
||||
inner.appendChild(note);
|
||||
inner.setAttribute('selectedIndex', 0);
|
||||
|
||||
note.placeholder = 'Drag annotations and write item-specific notes';
|
||||
|
||||
let head = document.createElement('hbox');
|
||||
head.setAttribute('align', 'center');
|
||||
let label = document.createElement('label');
|
||||
let button = document.createElement('button');
|
||||
button.setAttribute('label', 'Add');
|
||||
button.addEventListener('click', async () => {
|
||||
inner.setAttribute('selectedIndex', 1);
|
||||
let item = new Zotero.Item('note');
|
||||
item.libraryID = parentItem.libraryID;
|
||||
item.parentKey = parentItem.key;
|
||||
await item.saveTx();
|
||||
note.mode = 'edit';
|
||||
note.item = item;
|
||||
note.parentItem = null;
|
||||
_updateList();
|
||||
});
|
||||
head.append(label, button);
|
||||
|
||||
let grid = document.createElement('grid');
|
||||
grid.setAttribute('flex', 1);
|
||||
let columns = document.createElement('columns');
|
||||
let column1 = document.createElement('column');
|
||||
column1.setAttribute('flex', 1);
|
||||
let column2 = document.createElement('column');
|
||||
columns.append(column1, column2);
|
||||
grid.append(columns);
|
||||
let rows = document.createElement('rows');
|
||||
rows.setAttribute('flex', 1);
|
||||
grid.append(rows);
|
||||
|
||||
list.append(head, grid);
|
||||
|
||||
let parentNotes = parentItem.getNotes();
|
||||
if (parentNotes.length == 0) {
|
||||
inner.setAttribute('selectedIndex', 1);
|
||||
let item = new Zotero.Item('note');
|
||||
item.libraryID = parentItem.libraryID;
|
||||
item.parentKey = parentItem.key;
|
||||
note.mode = 'edit';
|
||||
note.item = item;
|
||||
note.parentItem = null;
|
||||
}
|
||||
else if (parentNotes.length == 1) {
|
||||
inner.setAttribute('selectedIndex', 1);
|
||||
note.mode = 'edit';
|
||||
note.item = Zotero.Items.get(parentNotes[0]);
|
||||
note.parentItem = null;
|
||||
}
|
||||
|
||||
let _updateList = () => {
|
||||
while (rows.hasChildNodes()) {
|
||||
rows.removeChild(rows.firstChild);
|
||||
}
|
||||
let parentNotes = Zotero.Items.get(parentItem.getNotes());
|
||||
this._appendNoteRows(parentNotes, rows, true, (id) => {
|
||||
inner.setAttribute('selectedIndex', 1);
|
||||
note.mode = 'edit';
|
||||
note.item = Zotero.Items.get(id);
|
||||
note.parentItem = null;
|
||||
}, (id) => {
|
||||
ZoteroItemPane.removeNote(id);
|
||||
});
|
||||
}
|
||||
|
||||
_updateList();
|
||||
}
|
||||
|
||||
this.removeTabContext = function (tabID) {
|
||||
document.getElementById(tabID + '-context').remove();
|
||||
_contextNoteUpdaters = _contextNoteUpdaters.filter(x => x.tabID != tabID);
|
||||
};
|
||||
|
||||
this.selectTabContext = function (tabID, type) {
|
||||
let contextualDeck = document.getElementById('zotero-item-pane-contextual-deck');
|
||||
let prevIndex = contextualDeck.selectedIndex;
|
||||
contextualDeck.selectedIndex = Array.from(contextualDeck.children).findIndex(x => x.id == tabID + '-context');
|
||||
|
||||
let toolbar = document.getElementById('zotero-pane-horizontal-space');
|
||||
let extendedToolbar = document.getElementById('zotero-item-pane-padding-top');
|
||||
let itemPane = document.getElementById('zotero-item-pane');
|
||||
|
||||
if (prevIndex != 0) {
|
||||
_pdfTabHidden = itemPane.hidden;
|
||||
}
|
||||
|
||||
if (type == 'library') {
|
||||
toolbar.hidden = false;
|
||||
extendedToolbar.hidden = true;
|
||||
|
@ -817,27 +773,235 @@ var ZoteroItemPane = new function() {
|
|||
else {
|
||||
toolbar.hidden = true;
|
||||
extendedToolbar.hidden = false;
|
||||
itemPane.hidden = _pdfTabHidden;
|
||||
}
|
||||
|
||||
let state = contextualDeck.children[contextualDeck.selectedIndex].getAttribute('state');
|
||||
let mainDeck = document.getElementById('zotero-item-pane-main-deck');
|
||||
document.getElementById('temp-toggle-1').firstChild.remove();
|
||||
document.getElementById('temp-toggle-2').firstChild.remove();
|
||||
if (state == 0) {
|
||||
document.getElementById('temp-toggle-1').append('■ □');
|
||||
document.getElementById('temp-toggle-2').append('■ □');
|
||||
mainDeck.selectedIndex = state;
|
||||
}
|
||||
else if (state == 1) {
|
||||
document.getElementById('temp-toggle-1').append('□ ■');
|
||||
document.getElementById('temp-toggle-2').append('□ ■');
|
||||
mainDeck.selectedIndex = state;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function _updateNoteCount() {
|
||||
var c = _notesList.childNodes.length;
|
||||
this.addPDFTabContext = function (tabID, itemID) {
|
||||
let contextualDeck = document.getElementById('zotero-item-pane-contextual-deck');
|
||||
|
||||
var str = 'pane.item.notes.count.';
|
||||
switch (c){
|
||||
case 0:
|
||||
str += 'zero';
|
||||
break;
|
||||
case 1:
|
||||
str += 'singular';
|
||||
break;
|
||||
default:
|
||||
str += 'plural';
|
||||
break;
|
||||
let container = document.createElement('vbox');
|
||||
container.id = tabID + '-context';
|
||||
container.className = 'zotero-item-pane-content';
|
||||
contextualDeck.appendChild(container);
|
||||
|
||||
var item = Zotero.Items.get(itemID);
|
||||
if (!item.parentID) {
|
||||
container.append('The PDF doesn\'t have a parent');
|
||||
return;
|
||||
}
|
||||
|
||||
_notesLabel.value = Zotero.getString(str, [c]);
|
||||
let parentID = item.parentID;
|
||||
|
||||
let mainDeck = document.getElementById('zotero-item-pane-main-deck');
|
||||
let pinDeck = document.getElementById('zotero-item-pane-pin-deck2');
|
||||
container.setAttribute('state', (mainDeck.selectedIndex == 1 && pinDeck.selectedIndex == 1) ? 1 : 0)
|
||||
|
||||
|
||||
let parentItem = Zotero.Items.get(parentID);
|
||||
|
||||
let tabbox = document.createElement('tabbox');
|
||||
tabbox.setAttribute('flex', '1');
|
||||
tabbox.className = 'zotero-view-tabbox';
|
||||
let tabs = document.createElement('tabs');
|
||||
tabs.className = 'zotero-editpane-tabs';
|
||||
|
||||
container.append(tabbox);
|
||||
|
||||
|
||||
let tabInfo = document.createElement('tab');
|
||||
tabInfo.setAttribute('label', Zotero.Intl.strings['zotero.tabs.info.label']);
|
||||
let tabNotes = document.createElement('tab');
|
||||
tabNotes.setAttribute('label', Zotero.Intl.strings['zotero.tabs.notes.label']);
|
||||
let tabTags = document.createElement('tab');
|
||||
tabTags.setAttribute('label', Zotero.Intl.strings['zotero.tabs.tags.label']);
|
||||
let tabRelated = document.createElement('tab');
|
||||
tabRelated.setAttribute('label', Zotero.Intl.strings['zotero.tabs.related.label']);
|
||||
tabs.append(tabInfo, tabNotes, tabTags, tabRelated);
|
||||
|
||||
let tabpanels = document.createElement('tabpanels');
|
||||
tabpanels.setAttribute('flex', '1');
|
||||
tabpanels.className = 'zotero-view-item';
|
||||
|
||||
tabbox.append(tabs, tabpanels);
|
||||
|
||||
let panelInfo = document.createElement('tabpanel');
|
||||
panelInfo.setAttribute('flex', '1')
|
||||
panelInfo.className = 'zotero-editpane-item-box';
|
||||
let itemBox = document.createElement('zoteroitembox');
|
||||
itemBox.setAttribute('flex', '1');
|
||||
panelInfo.append(itemBox);
|
||||
|
||||
let panelNotes = document.createElement('tabpanel');
|
||||
panelNotes.setAttribute('flex', '1');
|
||||
panelNotes.setAttribute('orient', 'vertical');
|
||||
|
||||
var deck = document.createElement('deck');
|
||||
deck.setAttribute('flex', '1');
|
||||
|
||||
panelNotes.append(deck);
|
||||
|
||||
var vbox2 = document.createElement('vbox');
|
||||
|
||||
|
||||
let returnButton = document.createElement('toolbarbutton');
|
||||
returnButton.className = 'zotero-tb-button';
|
||||
returnButton.id = 'zotero-tb-return';
|
||||
returnButton.style.listStyleImage = 'url(\'chrome://zotero/skin/citation-delete.png\')'
|
||||
returnButton.addEventListener('click', () => {
|
||||
deck.setAttribute('selectedIndex', 0);
|
||||
});
|
||||
|
||||
var bar = document.createElement('hbox')
|
||||
bar.append(returnButton, 'Child Notes');
|
||||
bar.style.overflowX = 'hidden';
|
||||
bar.style.textOverflow = 'ellipsis';
|
||||
bar.style.fontWeight = 'bold';
|
||||
|
||||
let note = document.createElement('zoteronoteeditor');
|
||||
|
||||
note.setAttribute('flex', 1);
|
||||
|
||||
vbox2.append(bar, note);
|
||||
|
||||
|
||||
var vbox = document.createElement('vbox');
|
||||
vbox.setAttribute('flex', '1');
|
||||
vbox.setAttribute('class', 'zotero-box');
|
||||
panelNotes.append(vbox);
|
||||
|
||||
var hbox = document.createElement('hbox');
|
||||
hbox.setAttribute('align', 'center');
|
||||
|
||||
var label = document.createElement('label');
|
||||
var button = document.createElement('button');
|
||||
button.setAttribute('label', Zotero.Intl.strings['zotero.item.add']);
|
||||
button.addEventListener('click', () => {
|
||||
deck.setAttribute('selectedIndex', 1);
|
||||
let item = new Zotero.Item('note');
|
||||
item.libraryID = parentItem.libraryID;
|
||||
item.parentItemID = parentItem.id;
|
||||
note.mode = 'edit';
|
||||
note.item = item;
|
||||
note.focus();
|
||||
});
|
||||
hbox.append(label, button);
|
||||
|
||||
var grid = document.createElement('grid');
|
||||
grid.setAttribute('flex', 1);
|
||||
var columns = document.createElement('columns');
|
||||
var column = document.createElement('column');
|
||||
column.setAttribute('flex', 1);
|
||||
columns.append(column);
|
||||
var column = document.createElement('column');
|
||||
columns.append(column);
|
||||
grid.append(columns);
|
||||
var rows = document.createElement('rows');
|
||||
rows.setAttribute('flex', 1);
|
||||
grid.append(rows);
|
||||
|
||||
vbox.append(hbox, grid);
|
||||
|
||||
deck.append(vbox, vbox2);
|
||||
|
||||
deck.setAttribute('selectedIndex', 0);
|
||||
deck.className = 'zotero-item-pane-content';
|
||||
|
||||
|
||||
let panelTags = document.createElement('tabpanel');
|
||||
panelTags.setAttribute('orient', 'vertical');
|
||||
panelTags.setAttribute('context', 'tags-context-menu');
|
||||
panelTags.className = 'tags-pane';
|
||||
panelTags.style.display = 'flex';
|
||||
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
||||
var div = document.createElementNS(HTML_NS, 'div');
|
||||
div.className = 'tags-box-container';
|
||||
div.style.display = 'flex';
|
||||
div.style.flexGrow = '1';
|
||||
panelTags.append(div);
|
||||
|
||||
let panelRelated = document.createElement('tabpanel');
|
||||
let relatedBox = document.createElement('relatedbox');
|
||||
relatedBox.setAttribute('flex', '1');
|
||||
relatedBox.className = 'zotero-editpane-related';
|
||||
panelRelated.append(relatedBox);
|
||||
|
||||
tabpanels.append(panelInfo, panelNotes, panelTags, panelRelated);
|
||||
|
||||
itemBox.mode = 'edit';
|
||||
itemBox.item = Zotero.Items.get(parentID);
|
||||
|
||||
relatedBox.mode = 'edit';
|
||||
relatedBox.item = parentItem;
|
||||
|
||||
panelRelated.addEventListener('click', (event) => {
|
||||
if (event.originalTarget.closest('.zotero-clicky')) {
|
||||
Zotero_Tabs.select('zotero-pane');
|
||||
}
|
||||
});
|
||||
|
||||
let _renderNotesPanel = () => {
|
||||
while (rows.firstChild) {
|
||||
rows.firstChild.remove();
|
||||
}
|
||||
|
||||
let parentNotes = Zotero.Items.get(parentItem.getNotes());
|
||||
this._appendNoteRows(parentNotes, rows, true, (id) => {
|
||||
deck.setAttribute('selectedIndex', 1);
|
||||
note.mode = 'edit';
|
||||
note.item = Zotero.Items.get(id);
|
||||
note.parentItem = null;
|
||||
}, (id) => {
|
||||
ZoteroItemPane.removeNote(id);
|
||||
});
|
||||
|
||||
var c = parentNotes.length;
|
||||
var str = 'pane.item.notes.count.' + (c == 0 && 'zero' || c == 1 && 'singular' || 'plural');
|
||||
label.value = Zotero.getString(str, [c]);
|
||||
}
|
||||
|
||||
_contextNoteUpdaters.push({
|
||||
tabID,
|
||||
callback: _renderNotesPanel
|
||||
});
|
||||
|
||||
_renderNotesPanel();
|
||||
|
||||
let mode = 'edit';
|
||||
|
||||
let _tagsBox = { current: null };
|
||||
let focusItemsList = false;
|
||||
|
||||
let _renderTagsPanel = () => {
|
||||
ReactDOM.render(
|
||||
<TagsBoxContainer
|
||||
key={'tagsBox-' + parentItem.id}
|
||||
item={parentItem}
|
||||
editable={mode != 'view'}
|
||||
ref={_tagsBox}
|
||||
onResetSelection={focusItemsList}
|
||||
/>,
|
||||
div
|
||||
);
|
||||
}
|
||||
|
||||
_renderTagsPanel();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,23 +69,23 @@
|
|||
<button id="zotero-item-show-original" label="Show Original"
|
||||
oncommand="ZoteroPane_Local.showOriginalItem()" hidden="true"/>
|
||||
|
||||
<deck id="zotero-item-pane-content" selectedIndex="0" flex="1">
|
||||
<deck id="zotero-item-pane-content" class="zotero-item-pane-content" selectedIndex="0" flex="1">
|
||||
<!-- Center label (for zero or multiple item selection) -->
|
||||
<groupbox id="zotero-item-pane-groupbox" pack="center" align="center">
|
||||
<vbox id="zotero-item-pane-message-box"/>
|
||||
</groupbox>
|
||||
|
||||
<!-- Regular item -->
|
||||
<tabbox id="zotero-view-tabbox" flex="1" onselect="if (!ZoteroPane_Local.collectionsView.selection || event.originalTarget.localName != 'tabpanels') { return; }; ZoteroItemPane.viewItem(ZoteroPane_Local.getSelectedItems()[0], ZoteroPane_Local.collectionsView.editable ? 'edit' : 'view', this.selectedIndex)">
|
||||
<tabs id="zotero-editpane-tabs">
|
||||
<tabbox id="zotero-view-tabbox" class="zotero-view-tabbox" flex="1" onselect="if (!ZoteroPane_Local.collectionsView.selection || event.originalTarget.localName != 'tabpanels') { return; }; ZoteroItemPane.viewItem(ZoteroPane_Local.getSelectedItems()[0], ZoteroPane_Local.collectionsView.editable ? 'edit' : 'view', this.selectedIndex)">
|
||||
<tabs id="zotero-editpane-tabs" class="zotero-editpane-tabs">
|
||||
<tab id="zotero-editpane-info-tab" label="&zotero.tabs.info.label;"/>
|
||||
<tab id="zotero-editpane-notes-tab" label="&zotero.tabs.notes.label;"/>
|
||||
<tab id="zotero-editpane-tags-tab" label="&zotero.tabs.tags.label;"/>
|
||||
<tab id="zotero-editpane-related-tab" label="&zotero.tabs.related.label;"/>
|
||||
</tabs>
|
||||
<tabpanels id="zotero-view-item" flex="1">
|
||||
<tabpanel>
|
||||
<zoteroitembox id="zotero-editpane-item-box" flex="1"/>
|
||||
<tabpanels id="zotero-view-item" class="zotero-view-item" flex="1">
|
||||
<tabpanel flex="1">
|
||||
<zoteroitembox id="zotero-editpane-item-box" class="zotero-editpane-item-box" flex="1"/>
|
||||
</tabpanel>
|
||||
|
||||
<tabpanel flex="1" orient="vertical">
|
||||
|
@ -104,12 +104,12 @@
|
|||
</vbox>
|
||||
</tabpanel>
|
||||
|
||||
<tabpanel id="tags-pane" orient="vertical" context="tags-context-menu">
|
||||
<html:div id="tags-box-container"></html:div>
|
||||
<tabpanel id="tags-pane" class="tags-pane" orient="vertical" context="tags-context-menu">
|
||||
<html:div id="tags-box-container" class="tags-box-container"></html:div>
|
||||
</tabpanel>
|
||||
|
||||
<tabpanel>
|
||||
<relatedbox id="zotero-editpane-related" flex="1"/>
|
||||
<relatedbox id="zotero-editpane-related" class="zotero-editpane-related" flex="1"/>
|
||||
</tabpanel>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
|
@ -123,6 +123,10 @@
|
|||
<zoteronoteeditor id="zotero-note-editor" flex="1" notitle="1"
|
||||
previousfocus="zotero-items-tree"
|
||||
onerror="return;ZoteroPane.displayErrorMessage(); /*this.mode = 'view'*/"/>
|
||||
<!-- TODO: Localize -->
|
||||
<button id="zotero-view-note-sidebar-button"
|
||||
label="Edit in notes sidebar"
|
||||
oncommand="ZoteroItemPane.openNoteSidebar()"/>
|
||||
<button id="zotero-view-note-button"
|
||||
label="&zotero.notes.separate;"
|
||||
oncommand="ZoteroItemPane.openNoteWindow()"/>
|
||||
|
|
|
@ -233,9 +233,7 @@
|
|||
<menuitem class="menu-type-reader" label="Even Spreads" oncommand="ZoteroStandalone.onReaderCmd('switchspreadmode_even')"/>
|
||||
<menuseparator class="menu-type-reader"/>
|
||||
|
||||
<menu id="layout-menu"
|
||||
class="menu-type-library"
|
||||
label="&layout.label;">
|
||||
<menu id="layout-menu" label="&layout.label;">
|
||||
<menupopup oncommand="ZoteroStandalone.onViewMenuItemClick(event)">
|
||||
<menuitem
|
||||
id="view-menuitem-standard"
|
||||
|
|
|
@ -113,10 +113,10 @@ var Zotero_Tabs = new function () {
|
|||
index = index || this._tabs.length;
|
||||
this._tabs.splice(index, 0, tab);
|
||||
this._update();
|
||||
Zotero.Notifier.trigger('add', 'tab', id, notifierData);
|
||||
if (select) {
|
||||
this.select(id);
|
||||
}
|
||||
Zotero.Notifier.trigger('add', 'tab', id, notifierData);
|
||||
return { id, container };
|
||||
};
|
||||
|
||||
|
|
|
@ -165,7 +165,8 @@ class EditorInstance {
|
|||
citationItems: [citationItem],
|
||||
properties: {}
|
||||
};
|
||||
list.push({ annotation, citation });
|
||||
let formattedCitation = (await this._getFormattedCitationParts(citation)).join(';');
|
||||
list.push({ annotation, citation, formattedCitation });
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -187,15 +188,17 @@ class EditorInstance {
|
|||
continue;
|
||||
}
|
||||
|
||||
list.push({
|
||||
citation: {
|
||||
let citation = {
|
||||
citationItems: [{
|
||||
uris: [Zotero.URI.getItemURI(item)],
|
||||
itemData: Zotero.Cite.System.prototype.retrieveItem(item),
|
||||
itemData: Zotero.Cite.System.prototype.retrieveItem(item)
|
||||
}],
|
||||
properties: {}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
let formattedCitation = (await this._getFormattedCitationParts(citation)).join(';');
|
||||
|
||||
list.push({ citation, formattedCitation });
|
||||
}
|
||||
}
|
||||
else if (type === 'zotero/annotation') {
|
||||
|
@ -272,6 +275,13 @@ class EditorInstance {
|
|||
this._save(noteData);
|
||||
return;
|
||||
}
|
||||
case 'generateCitation': {
|
||||
let { citation, pos } = message;
|
||||
let formattedCitation = (await this._getFormattedCitationParts(citation)).join(';');
|
||||
let list = [{ citation, formattedCitation }];
|
||||
this._postMessage({ action: 'insertAnnotationsAndCitations', list, pos });
|
||||
return;
|
||||
}
|
||||
case 'subscribeProvider': {
|
||||
let { subscription } = message;
|
||||
this._subscriptions.push(subscription);
|
||||
|
@ -339,8 +349,8 @@ class EditorInstance {
|
|||
async _feedSubscription(subscription) {
|
||||
let { id, type, nodeId, data } = subscription;
|
||||
if (type === 'citation') {
|
||||
let formattedCitation = await this._getFormattedCitation(data.citation);
|
||||
this._postMessage({ action: 'notifyProvider', id, type, data: { formattedCitation } });
|
||||
let parts = await this._getFormattedCitationParts(data.citation);
|
||||
this._postMessage({ action: 'notifyProvider', id, type, data: { formattedCitation: parts.join(';') } });
|
||||
}
|
||||
else if (type === 'image') {
|
||||
let { attachmentKey } = data;
|
||||
|
@ -548,7 +558,7 @@ class EditorInstance {
|
|||
return str;
|
||||
}
|
||||
|
||||
async _getFormattedCitation(citation) {
|
||||
async _getFormattedCitationParts(citation) {
|
||||
let formattedItems = [];
|
||||
for (let citationItem of citation.citationItems) {
|
||||
let item = await this._getItemFromURIs(citationItem.uris);
|
||||
|
@ -565,7 +575,7 @@ class EditorInstance {
|
|||
// formattedItems.push(formattedItem);
|
||||
// }
|
||||
}
|
||||
return formattedItems.join(';');
|
||||
return formattedItems;
|
||||
}
|
||||
|
||||
_getBackupStr(item) {
|
||||
|
@ -673,8 +683,10 @@ class EditorInstance {
|
|||
citationItem.itemData = Zotero.Cite.System.prototype.retrieveItem(item);
|
||||
}
|
||||
|
||||
let formattedCitation = (await that._getFormattedCitationParts(citation)).join(';');
|
||||
|
||||
if (progressCallback || !citationData.citationItems.length) {
|
||||
that._postMessage({ action: 'setCitation', nodeId, citation });
|
||||
that._postMessage({ action: 'setCitation', nodeId, citation, formattedCitation });
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -521,15 +521,9 @@ 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;
|
||||
}
|
||||
|
|
|
@ -131,29 +131,6 @@ var ZoteroPane = new function()
|
|||
|
||||
// continue loading pane
|
||||
_loadPane();
|
||||
|
||||
Zotero_Tabs.onTabSelect = (id, type) => {
|
||||
let toolbar = document.getElementById('zotero-pane-horizontal-space');
|
||||
let extendedToolbar = document.getElementById('zotero-item-pane-padding-top');
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1222,6 +1199,8 @@ var ZoteroPane = new function()
|
|||
// Rename tab
|
||||
Zotero_Tabs.rename('zotero-pane', collectionTreeRow.getName());
|
||||
|
||||
ZoteroItemPane.updateStandaloneNotesList(true);
|
||||
|
||||
// Clear quick search and tag selector when switching views
|
||||
document.getElementById('zotero-tb-search').value = "";
|
||||
if (ZoteroPane.tagSelector) {
|
||||
|
@ -1421,8 +1400,6 @@ var ZoteroPane = new function()
|
|||
}
|
||||
_lastSelectedItems = ids;
|
||||
|
||||
ZoteroItemPane.togglePane(true);
|
||||
|
||||
var tabs = document.getElementById('zotero-view-tabbox');
|
||||
|
||||
// save note when switching from a note
|
||||
|
@ -4074,8 +4051,7 @@ var ZoteroPane = new function()
|
|||
if (!this.collectionsView.editable) {
|
||||
continue;
|
||||
}
|
||||
ZoteroItemPane.pinNote(item.id);
|
||||
// document.getElementById('zotero-view-note-button').doCommand();
|
||||
document.getElementById('zotero-view-note-button').doCommand();
|
||||
}
|
||||
else if (item.isAttachment()) {
|
||||
yield this.viewAttachment(item.id, event);
|
||||
|
@ -4266,7 +4242,7 @@ var ZoteroPane = new function()
|
|||
|
||||
Zotero.debug("Opening " + path);
|
||||
Zotero.Notifier.trigger('open', 'file', item.id);
|
||||
launchFile(path, item.attachmentContentType);
|
||||
launchFile(path, item.attachmentContentType, item.id);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -5219,6 +5195,8 @@ var ZoteroPane = new function()
|
|||
|
||||
// Allow item pane to shrink to available height in stacked mode, but don't expand to be too
|
||||
// wide when there's no persisted width in non-stacked mode
|
||||
|
||||
// TODO: Fix this together with stacked view
|
||||
itemPane.setAttribute("flex", stackedLayout ? 1 : 0);
|
||||
|
||||
this.handleTagSelectorResize();
|
||||
|
@ -5232,6 +5210,8 @@ var ZoteroPane = new function()
|
|||
* Revisit when we're all HTML.
|
||||
*/
|
||||
this.updateTagsBoxSize = function () {
|
||||
// TODO: We can probably remove this function
|
||||
return;
|
||||
var pane = document.querySelector('#zotero-item-pane');
|
||||
var header = document.querySelector('#zotero-item-pane .tags-box-header');
|
||||
var list = document.querySelector('#zotero-item-pane .tags-box-list');
|
||||
|
|
|
@ -227,7 +227,7 @@
|
|||
</vbox>
|
||||
</vbox>
|
||||
|
||||
<hbox flex="1">
|
||||
<box id="zotero-layout-switcher" orient="horizontal" zotero-persist="orient" flex="1">
|
||||
<deck flex="1" id="tabs-deck">
|
||||
<vbox id="zotero-pane"
|
||||
onkeydown="ZoteroPane_Local.handleKeyDown(event, this.id)"
|
||||
|
@ -358,7 +358,6 @@
|
|||
<grippy id="zotero-collections-grippy"/>
|
||||
</splitter>
|
||||
|
||||
<box id="zotero-layout-switcher" orient="horizontal" zotero-persist="orient" flex="1">
|
||||
<vbox id="zotero-items-pane" zotero-persist="width height" flex="1">
|
||||
<deck id="zotero-items-pane-content" selectedIndex="0" flex="1">
|
||||
<!-- Key navigation is handled by listener in itemTreeView.js -->
|
||||
|
@ -376,171 +375,202 @@
|
|||
zotero-persist="current-view-group">
|
||||
<treecols id="zotero-items-columns-header">
|
||||
<treecol
|
||||
id="zotero-items-column-title" primary="true" default-in="default feed"
|
||||
id="zotero-items-column-title" primary="true"
|
||||
default-in="default feed"
|
||||
label="&zotero.items.title_column;" ignoreincolumnpicker="true"
|
||||
flex="4" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="4"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-firstCreator" default-in="default feed"
|
||||
label="&zotero.items.creator_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-itemType"
|
||||
label="&zotero.items.type_column;"
|
||||
width="40" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
width="40"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-date" default-in="feed"
|
||||
label="&zotero.items.date_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-year" disabled-in="feed"
|
||||
label="&zotero.items.year_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-publisher"
|
||||
label="&zotero.items.publisher_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-publicationTitle" disabled-in="feed"
|
||||
label="&zotero.items.publication_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-journalAbbreviation" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.journalAbbr_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-language"
|
||||
submenu="true"
|
||||
label="&zotero.items.language_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-accessDate" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.accessDate_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-libraryCatalog" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.libraryCatalog_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-callNumber" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.callNumber_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-rights"
|
||||
submenu="true"
|
||||
label="&zotero.items.rights_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-dateAdded" disabled-in="feed"
|
||||
label="&zotero.items.dateAdded_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-dateModified" disabled-in="feed"
|
||||
label="&zotero.items.dateModified_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-archive" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.archive_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-archiveLocation" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.archiveLocation_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-place" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.place_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-volume" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.volume_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-edition" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.edition_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-pages" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.pages_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-issue" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.issue_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-series" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.series_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-seriesTitle" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.seriesTitle_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-court" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.court_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-medium" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.medium_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-genre" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.genre_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-system" disabled-in="feed"
|
||||
submenu="true"
|
||||
label="&zotero.items.system_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-extra" disabled-in="feed"
|
||||
label="&zotero.items.extra_column;"
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1"
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-hasAttachment" default-in="default" disabled-in="feed"
|
||||
id="zotero-items-column-hasAttachment" default-in="default"
|
||||
disabled-in="feed"
|
||||
class="treecol-image"
|
||||
label="&zotero.tabs.attachments.label;"
|
||||
fixed="true"
|
||||
|
@ -567,7 +597,7 @@
|
|||
ondrop="ZoteroPane.itemsView.onDrop(event); ZoteroPane.itemsView.drop(-1, -1, event.dataTransfer)"/>
|
||||
</deck>
|
||||
</vbox>
|
||||
</box>
|
||||
|
||||
</hbox>
|
||||
</vbox>
|
||||
</deck>
|
||||
|
@ -579,8 +609,8 @@
|
|||
</splitter>
|
||||
|
||||
<!-- itemPane.xul -->
|
||||
<vbox id="zotero-item-pane" flex="1"/>
|
||||
</hbox>
|
||||
<vbox id="zotero-item-pane"/>
|
||||
</box>
|
||||
</vbox>
|
||||
|
||||
|
||||
|
|
|
@ -2,44 +2,44 @@
|
|||
padding: 0 2em;
|
||||
}
|
||||
|
||||
#zotero-view-tabbox, #zotero-item-pane-content > groupbox, #zotero-item-pane-content > groupbox > .groupbox-body
|
||||
.zotero-view-tabbox, .zotero-item-pane-content > groupbox, .zotero-item-pane-content > groupbox > .groupbox-body
|
||||
{
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
#zotero-view-tabbox tabs tab
|
||||
.zotero-view-tabbox tabs tab
|
||||
{
|
||||
margin-top: 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
#zotero-view-tabbox tabs tab .tab-text
|
||||
.zotero-view-tabbox tabs tab .tab-text
|
||||
{
|
||||
margin-top: .2em !important;
|
||||
margin-bottom: .25em !important;
|
||||
}
|
||||
|
||||
#zotero-view-item
|
||||
.zotero-view-item
|
||||
{
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#zotero-view-item.no-tabs
|
||||
.zotero-view-item.no-tabs
|
||||
{
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
#zotero-view-item > tabpanel > *
|
||||
.zotero-view-item > tabpanel > *
|
||||
{
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#zotero-view-item:not([selectedIndex="0"]) > tabpanel > * {
|
||||
.zotero-view-item:not([selectedIndex="0"]) > tabpanel > * {
|
||||
padding-top: .25em;
|
||||
}
|
||||
|
||||
#zotero-view-item > vbox
|
||||
.zotero-view-item > vbox
|
||||
{
|
||||
overflow: auto;
|
||||
margin-left: 5px;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 3d949e7c83a19af8afdd1de0fdb3f95dde4f4dea
|
||||
Subproject commit 1da855a9e2447ff0a1409401bc2ba87f9b307038
|
|
@ -26,6 +26,7 @@
|
|||
@import "components/editable";
|
||||
@import "components/icons";
|
||||
@import "components/mainWindow";
|
||||
@import "components/notesList";
|
||||
@import "components/progressMeter";
|
||||
@import "components/search";
|
||||
@import "components/syncButtonTooltip";
|
||||
|
|
53
scss/components/_notesList.scss
Normal file
53
scss/components/_notesList.scss
Normal file
|
@ -0,0 +1,53 @@
|
|||
.notes-list-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.notes-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 0;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.note-row {
|
||||
padding: 8px 0;
|
||||
|
||||
&:not(:last-child) {
|
||||
border-bottom: 1px solid $shade-3;
|
||||
}
|
||||
|
||||
.inner {
|
||||
.first-line {
|
||||
display: flex;
|
||||
|
||||
.title {
|
||||
flex-grow: 1;
|
||||
width: 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.second-line {
|
||||
display: flex;
|
||||
|
||||
.date {
|
||||
}
|
||||
|
||||
.body {
|
||||
flex-grow: 1;
|
||||
width: 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin-left: 10px;
|
||||
color: $shade-6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
#tags-pane {
|
||||
.tags-pane {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#tags-box-container {
|
||||
.tags-box-container {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
}
|
||||
|
@ -14,7 +14,11 @@
|
|||
$li-side-margin: 6px;
|
||||
|
||||
flex-grow: 1;
|
||||
width: 330px;
|
||||
//width: 330px;
|
||||
|
||||
// This is necessary for XUL layout to prevent children
|
||||
// container to force its height for the parent
|
||||
height: 0;
|
||||
|
||||
.tags-box-header {
|
||||
display: flex;
|
||||
|
@ -61,7 +65,7 @@
|
|||
.editable-container {
|
||||
flex-grow: 1;
|
||||
margin: 0 2px;
|
||||
width: $item-pane-width - $icon-width - $delete-button-width - ($li-side-margin * 2);
|
||||
//width: $item-pane-width - $icon-width - $delete-button-width - ($li-side-margin * 2);
|
||||
}
|
||||
|
||||
ul.tags-box-list > li:not(.multiline) .editable-container {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 156459aaf4dbba9dc91b10a4e8ecb1142e56484b
|
||||
Subproject commit f4374cdb6386ba5cdd818ff6e3ece74aae83b394
|
Loading…
Reference in a new issue