Skip to content
Snippets Groups Projects
Commit b56d147d authored by Jack Reed's avatar Jack Reed Committed by Chris Beer
Browse files

Enable configurable HTML sanitization ruleset for annotation display fixes #2871

parent b42d1a12
Branches
Tags
No related merge requests found
......@@ -58,7 +58,7 @@ export class CanvasAnnotations extends Component {
render() {
const {
annotations, classes, index, label, selectedAnnotationIds, t, totalSize,
listContainerComponent,
listContainerComponent, htmlSanitizationRuleSet,
} = this.props;
if (annotations.length === 0) return <></>;
......@@ -84,7 +84,10 @@ export class CanvasAnnotations extends Component {
onMouseLeave={this.handleAnnotationUnHighlight}
>
<ListItemText primaryTypographyProps={{ variant: 'body2' }}>
<SanitizedHtml ruleSet="iiif" htmlString={annotation.content} />
<SanitizedHtml
ruleSet={htmlSanitizationRuleSet}
htmlString={annotation.content}
/>
</ListItemText>
</ListItem>
))
......@@ -106,6 +109,7 @@ CanvasAnnotations.propTypes = {
classes: PropTypes.objectOf(PropTypes.string),
deselectAnnotation: PropTypes.func.isRequired,
highlightAnnotation: PropTypes.func.isRequired,
htmlSanitizationRuleSet: PropTypes.string,
index: PropTypes.number.isRequired,
label: PropTypes.string.isRequired,
listContainerComponent: PropTypes.elementType,
......@@ -118,6 +122,7 @@ CanvasAnnotations.propTypes = {
CanvasAnnotations.defaultProps = {
annotations: [],
classes: {},
htmlSanitizationRuleSet: 'iiif',
listContainerComponent: 'li',
selectedAnnotationIds: [],
};
......@@ -215,6 +215,7 @@ export default {
it: "Italiano",
},
annotations: {
htmlSanitizationRuleSet: 'iiif', // See src/lib/htmlRules.js for acceptable values
filteredMotivations: ['oa:commenting', 'sc:painting', 'commenting'],
},
classPrefix: 'mirador',
......
......@@ -32,6 +32,7 @@ const mapStateToProps = (state, { canvasId, windowId }) => ({
state, { canvasId, motivations: state.config.annotations.filteredMotivations, windowId },
),
),
htmlSanitizationRuleSet: state.config.annotations.htmlSanitizationRuleSet,
label: getCanvasLabel(state, {
canvasId,
windowId,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment