Skip to content

Commit

Permalink
Merge pull request #590 from NASA-IMPACT/fix/pdf-caption
Browse files Browse the repository at this point in the history
Fix captions in export
  • Loading branch information
wrynearson authored Aug 15, 2024
2 parents 418fc75 + aedb713 commit f27bf4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function PdfPreview() {
setDocument(applyNumberCaptionsToDocument(atbd.data.document));
waitForImages();
}
}, [atbd.status]);
}, [atbd.status, atbd.data]);

// This useEffect is responsible for generating the ToC and numbering
// after the document is transformed
Expand Down
10 changes: 1 addition & 9 deletions app/assets/scripts/utils/apply-number-captions-to-document.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import get from 'lodash.get';
import {
IMAGE_BLOCK,
TABLE_BLOCK
Expand Down Expand Up @@ -80,16 +79,9 @@ export function applyNumberCaptionsToDocument(document) {
return c;
}

const currentCaption = get(c, 'children[0].text');

return {
...c,
children: [
{
...c.children[0],
text: `${captionPrefix}${currentCaption}`
}
]
children: [{ text: captionPrefix }, ...c.children]
};
});

Expand Down

0 comments on commit f27bf4d

Please sign in to comment.