Switch to Library tab when dragging over EPUB or HTML files as well

This commit is contained in:
Martynas Bagdonas 2023-11-28 11:05:13 +00:00
parent 3eb1c3fb4f
commit 52c219c8b9

View file

@ -131,13 +131,14 @@ const ZoteroStandalone = new function() {
return;
});
// Switch to library tab if dragging over one or more PDF files
// Switch to library tab if dragging over PDF/EPUB/HTML file(s)
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')) {
&& !Array.from(event.dataTransfer.items).find(x =>
!['application/pdf', 'application/epub+zip', 'text/html'].includes(x.type))) {
Zotero_Tabs.select('zotero-pane');
}
}, true);