You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds the ability to configure an HTML viewer for detail pages, which will fetch the given URL (based on a configured base_url and a FairData field containing a path for each record) and extract a tei-text element from it to display at the top of the detail page.
Notes and questions
Obviously grabbing HTML from some user-configured thing and injecting it into the page is generally frowned upon. I attempted using sanitize-html (https://www.npmjs.com/package/sanitize-html), but of course the TEI has all sorts of non-standard tags, so I had to just tell it to allow all tags and attributes (in theory we could pass it a list, but constructing that list seems pretty involved). It then gave me console warnings about <script> and <style> being allowed, so I just brute-forced those two out. But I don't feel confident that this doesn't leave open some sort of vulnerability, although it might just not be worth worrying about more than I already have.
I made the assumption that the XML we want to display will come to us with exactly one <tei-text> element -- is that a safe assumption?
Definitely open to feedback on the exact layout/design; this is just a super basic implementation mirroring what we did for EditionCrafter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR
Adds the ability to configure an HTML viewer for detail pages, which will fetch the given URL (based on a configured

base_urland a FairData field containing a path for each record) and extract atei-textelement from it to display at the top of the detail page.Notes and questions
sanitize-html(https://www.npmjs.com/package/sanitize-html), but of course the TEI has all sorts of non-standard tags, so I had to just tell it to allow all tags and attributes (in theory we could pass it a list, but constructing that list seems pretty involved). It then gave me console warnings about<script>and<style>being allowed, so I just brute-forced those two out. But I don't feel confident that this doesn't leave open some sort of vulnerability, although it might just not be worth worrying about more than I already have.<tei-text>element -- is that a safe assumption?