RDFLib / prez-ui

BSD 3-Clause "New" or "Revised" License
10 stars 7 forks source link

Render property fields with type rdf:HTML #170

Open ashleysommer opened 4 months ago

ashleysommer commented 4 months ago

Fixes issues with displaying TERN Controlled Vocabularies and TERN Concept Schemes, that make heavy use of HTML-formatted fields in the vocabs and concepts.

Detect property rows with type rdf:HTML and render them directly in the dom.

Use dom-purify (vue-dom-purify Vue plugin) to sanitize the HTML before rendering, to prevent JS injection and other similar exploits.

Screenshot before fixes: image

Screenshot of concept description at top of PropsTable page with rendered HTML: Screenshot_20240702_132130

Screenshot of property row object field with type rdf:HTML rendered: Screenshot_20240702_132211

See it in action here: https://vocabs.bdr.gov.au/v/vocab/defn:nrm/emsa-cv:6fd39a33-9c4f-469e-80a5-e76b5d5f04a6

ashleysommer commented 4 months ago

See it in action here: https://vocabs.bdr.gov.au/v/vocab/defn:nrm/emsa-cv:6fd39a33-9c4f-469e-80a5-e76b5d5f04a6

This was inspired by TERN's Fork of Prez-UI here: https://linkeddata.tern.org.au/prez/dawe-cv/v/collection/nrm:f46fcbc6-0660-4e12-bcd4-c5642459b630/nrm:6fd39a33-9c4f-469e-80a5-e76b5d5f04a6