Skip to content

Commit

Permalink
Merge pull request #1115 from bcgov/dev-RQ-599
Browse files Browse the repository at this point in the history
Fix observation #1 in FOIMOD-599
  • Loading branch information
richard-aot authored Aug 21, 2024
2 parents eb20aaa + e6b4f3b commit 7aa9c26
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions web/src/components/FOI/Home/Redlining.js
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,9 @@ const Redlining = React.forwardRef(
let username = docViewer?.getAnnotationManager()?.getCurrentUser();
for (const entry in annotData) {
let xml = parser.parseFromString(annotData[entry]);
// import redactions first, free text later, so translucent redaction won't cover free text
let xmlAnnotsChildren_redaction = [];
let xmlAnnotsChildren_others = [];
for (let annot of xml.getElementsByTagName("annots")[0].children) {
let txt = domParser.parseFromString(
annot.getElementsByTagName("trn-custom-data")[0].attributes.bytes,
Expand All @@ -1441,6 +1444,12 @@ const Redlining = React.forwardRef(
(p) => p.pageNo - 1 === Number(originalPageNo)
)?.stitchedPageNo - 1
)?.toString();
if(annot.attributes.subject === "Redact") {
xmlAnnotsChildren_redaction.push(annot);
} else {
xmlAnnotsChildren_others.push(annot);
}
xml.getElementsByTagName("annots")[0].children = [...xmlAnnotsChildren_redaction, ...xmlAnnotsChildren_others];
}
xml = parser.toString(xml);
const _annotations = await annotManager.importAnnotations(xml);
Expand Down

0 comments on commit 7aa9c26

Please sign in to comment.