Propagate annotation deletion between reader instances of the same file

Fixes #3375
Fixes #3241
This commit is contained in:
Martynas Bagdonas 2023-10-27 18:24:59 +01:00
parent ec464a048a
commit 4266df4d3a

View file

@ -1389,14 +1389,16 @@ class Reader {
}
}
else {
let annotationItems = item.getAnnotations();
reader.annotationItemIDs = annotationItems.map(x => x.id);
let affectedAnnotations = annotationItems.filter(({ id }) => (
ids.includes(id)
&& !(extraData && extraData[id] && extraData[id].instanceID === reader._instanceID)
));
if (affectedAnnotations.length) {
reader.setAnnotations(affectedAnnotations);
if (['add', 'modify'].includes(event)) {
let annotationItems = item.getAnnotations();
reader.annotationItemIDs = annotationItems.map(x => x.id);
let affectedAnnotations = annotationItems.filter(({ id }) => (
ids.includes(id)
&& !(extraData && extraData[id] && extraData[id].instanceID === reader._instanceID)
));
if (affectedAnnotations.length) {
reader.setAnnotations(affectedAnnotations);
}
}
// Update title if the PDF attachment or the parent item changes
if (ids.includes(reader.itemID) || ids.includes(item.parentItemID)) {