Show "Add Note from Annotations" for all items with PDF attachments
So that this works for PDFs with external annotations that haven't yet been processed. Going forward, if we add automatic/background scanning, we can avoid showing this option if the file hasn't changed and there are no Zotero annotations, which would probably be the majority of attachments.
This commit is contained in:
parent
ea18641a62
commit
f161d167ae
1 changed files with 7 additions and 6 deletions
|
@ -3090,7 +3090,10 @@ var ZoteroPane = new function()
|
|||
|
||||
|
||||
function isAttachmentWithExtractableAnnotations(item) {
|
||||
return item.isPDFAttachment() && item.getAnnotations().some(x => x.annotationType != 'ink');
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -4458,6 +4461,7 @@ var ZoteroPane = new function()
|
|||
this.displayCannotEditLibraryMessage();
|
||||
return;
|
||||
}
|
||||
await Zotero.PDFWorker.import(attachment.id, true);
|
||||
var note = await Zotero.EditorInstance.createNoteFromAnnotations(
|
||||
attachment.getAnnotations().filter(x => x.annotationType != 'ink'), attachment.parentID
|
||||
);
|
||||
|
@ -4478,13 +4482,10 @@ var ZoteroPane = new function()
|
|||
for (let item of items) {
|
||||
let attachments = [];
|
||||
if (item.isRegularItem()) {
|
||||
// Find all child attachments with non-ink annotations
|
||||
// Find all child attachments with extractable annotations
|
||||
attachments.push(
|
||||
...Zotero.Items.get(item.getAttachments())
|
||||
.filter((x) => {
|
||||
return x.isPDFAttachment()
|
||||
&& x.getAnnotations().some(x => x.annotationType != 'ink');
|
||||
})
|
||||
.filter(item => isAttachmentWithExtractableAnnotations(item))
|
||||
);
|
||||
}
|
||||
else if (item.isFileAttachment()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue