Avoid error interrupting annotation extraction from multiple items

This commit is contained in:
Martynas Bagdonas 2022-05-16 13:33:52 +03:00 committed by Dan Stillman
parent 477dd69d54
commit b98a5e0545
3 changed files with 14 additions and 8 deletions

View file

@ -437,9 +437,11 @@ var ZoteroContextPane = new function () {
if (!attachment) { if (!attachment) {
return; return;
} }
var note = await Zotero.EditorInstance.createNoteFromAnnotations( var annotations = attachment.getAnnotations().filter(x => x.annotationType != 'ink');
attachment.getAnnotations().filter(x => x.annotationType != 'ink'), child && attachment.parentID if (!annotations.length) {
); return;
}
var note = await Zotero.EditorInstance.createNoteFromAnnotations(annotations, child && attachment.parentID);
_updateAddToNote(); _updateAddToNote();

View file

@ -4824,9 +4824,11 @@ var ZoteroPane = new function()
return; return;
} }
await Zotero.PDFWorker.import(attachment.id, true); await Zotero.PDFWorker.import(attachment.id, true);
var note = await Zotero.EditorInstance.createNoteFromAnnotations( var annotations = attachment.getAnnotations().filter(x => x.annotationType != 'ink');
attachment.getAnnotations().filter(x => x.annotationType != 'ink'), attachment.parentID if (!annotations.length) {
); return;
}
var note = await Zotero.EditorInstance.createNoteFromAnnotations(annotations, attachment.parentID);
if (!skipSelect) { if (!skipSelect) {
await this.selectItem(note.id); await this.selectItem(note.id);
} }
@ -4864,7 +4866,9 @@ var ZoteroPane = new function()
attachment, attachment,
{ skipSelect: true } { skipSelect: true }
); );
itemIDsToSelect.push(note.id); if (note) {
itemIDsToSelect.push(note.id);
}
} }
} }
await this.selectItems(itemIDsToSelect); await this.selectItems(itemIDsToSelect);

@ -1 +1 @@
Subproject commit 1a3fa7b30df0a1530d49042a308e0840ac907f1a Subproject commit fb3daf6c7e1d7a91992deeea52889cb9c95972f7