Switch to library tab when dragging a PDF file over Zotero window

This commit is contained in:
Martynas Bagdonas 2021-09-07 16:53:20 +03:00
parent d38d42d60c
commit 7468065528

View file

@ -118,6 +118,17 @@ const ZoteroStandalone = new function() {
window.close();
return;
});
// Switch to library tab if dragging over one or more PDF files
window.addEventListener('dragover', function (event) {
// TODO: Consider allowing more (or all) file types, although shouldn't interfere with image dragging to note editor
if (Zotero_Tabs.selectedID != 'zotero-pane'
&& event.dataTransfer.items
&& event.dataTransfer.items.length
&& !Array.from(event.dataTransfer.items).find(x => x.type != 'application/pdf')) {
Zotero_Tabs.select('zotero-pane');
}
}, true);
}
this.switchMenuType = function (type) {