Skip to content
Snippets Groups Projects
Commit 045ea512 authored by Mathias Maaß's avatar Mathias Maaß
Browse files

Create different html rule sets. Part of #1854

parent 94972957
Branches
Tags
No related merge requests found
...@@ -5,7 +5,7 @@ import SanitizedHtml from '../../../src/components/SanitizedHtml'; ...@@ -5,7 +5,7 @@ import SanitizedHtml from '../../../src/components/SanitizedHtml';
const wrapper = shallow( const wrapper = shallow(
<SanitizedHtml <SanitizedHtml
htmlString="<script>doBadThings()</script><b>Don't worry!</b>" htmlString="<script>doBadThings()</script><b>Don't worry!</b>"
ruleSet="basic" ruleSet="iiif"
/>, />,
); );
......
const basic = { // Only remove security related tags and attributes. Allow each other.
const liberal = {};
// No html at all. Only text will remain.
const noHtml = {
ALLOWED_TAGS: [],
};
// Presentation API 2 suggestion.
const iiif = {
ALLOWED_TAGS: ['a', 'b', 'br', 'i', 'img', 'p', 'span'],
ALLOWED_ATTR: ['href', 'src', 'alt'],
};
// Rule set that is used in Mirador 2.
const mirador2 = {
ALLOWED_TAGS: ['a', 'b', 'br', 'i', 'img', 'p', 'span', 'strong', 'em', 'ul', 'ol', 'li'], ALLOWED_TAGS: ['a', 'b', 'br', 'i', 'img', 'p', 'span', 'strong', 'em', 'ul', 'ol', 'li'],
ALLOWED_ATTR: ['href', 'target', 'src', 'alt', 'dir'], ALLOWED_ATTR: ['href', 'target', 'src', 'alt', 'dir'],
}; };
export default { basic }; export default {
liberal,
noHtml,
iiif,
mirador2,
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment