mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-03 03:58:01 +00:00
15 lines
456 B
JavaScript
15 lines
456 B
JavaScript
import { helper } from '@ember/component/helper';
|
|
import { debug } from '@ember/debug';
|
|
import { htmlSafe } from '@ember/template';
|
|
import { sanitize } from 'dompurify';
|
|
|
|
export default helper(function sanitizedHtml([htmlString]) {
|
|
try {
|
|
return htmlSafe(sanitize(htmlString));
|
|
} catch (e) {
|
|
debug('Error sanitizing string', e);
|
|
// I couldn't get this to actually fail but as a fallback render the value as-is
|
|
return htmlString;
|
|
}
|
|
});
|