/* global html_sanitize*/ import cajaSanitizers from 'ghost-admin/utils/caja-sanitizers'; import {helper} from '@ember/component/helper'; import {htmlSafe} from '@ember/string'; export default helper(function (params) { if (!params || !params.length) { return; } let escapedhtml = params[0] || ''; // replace script and iFrame escapedhtml = escapedhtml.replace(/)<[^<]*)*<\/script>/gi, '
Embedded JavaScript
'); escapedhtml = escapedhtml.replace(/)<[^<]*)*<\/iframe>/gi, '
Embedded iFrame
'); // sanitize HTML /* eslint-disable camelcase */ escapedhtml = html_sanitize(escapedhtml, cajaSanitizers.url, cajaSanitizers.id); /* eslint-enable camelcase */ return htmlSafe(escapedhtml); });