From 6a4715c324187957be69c57a3e32df65a672817b Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Wed, 5 Jul 2023 14:45:11 -0400 Subject: [PATCH] Enable "Add Note from Annotations" for EPUBs and snapshots --- chrome/content/zotero/xpcom/data/item.js | 8 ++++++++ chrome/content/zotero/zoteroPane.js | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 71cc3676c3..ddbf978af1 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -2427,6 +2427,14 @@ Zotero.Item.prototype.isPDFAttachment = function () { }; +/** + * @return {Boolean} - Returns true if item is a stored or linked EPUB attachment + */ +Zotero.Item.prototype.isEPUBAttachment = function () { + return this.isFileAttachment() && this.attachmentContentType == 'application/epub+zip'; +}; + + /** * Returns number of child attachments of item * diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 111710abaa..c734812612 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -3990,8 +3990,9 @@ var ZoteroPane = new function() function isAttachmentWithExtractableAnnotations(item) { // For now, consider all PDF attachments eligible, since we want to extract external // annotations in unprocessed files if present - //return item.isPDFAttachment() && item.getAnnotations().some(x => x.annotationType != 'ink'); - return item.isPDFAttachment(); + // item.isPDFAttachment() && item.getAnnotations().some(x => x.annotationType != 'ink'); + return item.isPDFAttachment() + || (item.isEPUBAttachment() || item.isSnapshotAttachment()) && item.getAnnotations().length; }