parent
4e68b624f2
commit
a07c052cf0
3 changed files with 48 additions and 10 deletions
|
@ -54,6 +54,12 @@ const ZoteroStandalone = new function() {
|
|||
{
|
||||
notify: async (action, type, ids, extraData) => {
|
||||
if (action == 'select') {
|
||||
// Reader doesn't have tabID yet
|
||||
setTimeout(async () => {
|
||||
// Item and other things might not be loaded yet when reopening tabs
|
||||
await Zotero.Schema.schemaUpdatePromise;
|
||||
this.updateQuickCopyOptions();
|
||||
}, 0);
|
||||
// "library" or "reader"
|
||||
this.switchMenuType(extraData[ids[0]].type);
|
||||
setTimeout(() => ZoteroPane.updateToolbarPosition(), 0);
|
||||
|
@ -283,13 +289,30 @@ const ZoteroStandalone = new function() {
|
|||
|
||||
this.updateQuickCopyOptions = function () {
|
||||
var selected = false;
|
||||
try {
|
||||
selected = Zotero.getActiveZoteroPane()
|
||||
.getSelectedItems()
|
||||
.filter(item => item.isRegularItem())
|
||||
.length;
|
||||
|
||||
let win = Zotero.getMainWindow();
|
||||
if (win) {
|
||||
if (win.Zotero_Tabs.selectedID == 'zotero-pane') {
|
||||
try {
|
||||
selected = win.ZoteroPane
|
||||
.getSelectedItems()
|
||||
.filter(item => item.isRegularItem())
|
||||
.length;
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
win.ZoteroPane.updateQuickCopyCommands(win.ZoteroPane.getSelectedItems());
|
||||
}
|
||||
else {
|
||||
let reader = Zotero.Reader.getByTabID(win.Zotero_Tabs.selectedID);
|
||||
if (reader) {
|
||||
let item = Zotero.Items.get(reader.itemID);
|
||||
selected = !!item.parentItemID;
|
||||
item = item.parentItem || item;
|
||||
win.ZoteroPane.updateQuickCopyCommands([item]);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
var format = Zotero.QuickCopy.getFormatFromURL(Zotero.QuickCopy.lastActiveURL);
|
||||
format = Zotero.QuickCopy.unserializeSetting(format);
|
||||
|
|
|
@ -183,13 +183,11 @@
|
|||
<menuitem id="menu_cut"/>
|
||||
<menuitem id="menu_copy"/>
|
||||
<menuitem id="menu_copyCitation"
|
||||
class="menu-type-library"
|
||||
label="©CitationCmd.label;"
|
||||
command="cmd_zotero_copyCitation"
|
||||
key="key_copyCitation"
|
||||
hidden="true"/>
|
||||
<menuitem id="menu_copyBibliography"
|
||||
class="menu-type-library"
|
||||
label="©BibliographyCmd.label;"
|
||||
command="cmd_zotero_copyBibliography"
|
||||
key="key_copyBibliography"
|
||||
|
|
|
@ -1330,7 +1330,11 @@ var ZoteroPane = new function()
|
|||
// selection hasn't changed, because the selected items might have been modified.
|
||||
this.updateItemPaneButtons(selectedItems);
|
||||
|
||||
this.updateQuickCopyCommands(selectedItems);
|
||||
// Tab selection observer in standalone.js makes sure that
|
||||
// updateQuickCopyCommands is called
|
||||
if (Zotero_Tabs.selectedID == 'zotero-pane') {
|
||||
this.updateQuickCopyCommands(selectedItems);
|
||||
}
|
||||
|
||||
// Check if selection has actually changed. The onselect event that calls this
|
||||
// can be called in various situations where the selection didn't actually change,
|
||||
|
@ -2069,7 +2073,20 @@ var ZoteroPane = new function()
|
|||
|
||||
|
||||
this.copySelectedItemsToClipboard = function (asCitations) {
|
||||
var items = this.getSelectedItems();
|
||||
var items = [];
|
||||
if (Zotero_Tabs.selectedID == 'zotero-pane') {
|
||||
items = this.getSelectedItems();
|
||||
}
|
||||
else {
|
||||
var reader = Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);
|
||||
if (reader) {
|
||||
let item = Zotero.Items.get(reader.itemID);
|
||||
if (item.parentItem) {
|
||||
items = [item.parentItem];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!items.length) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue