import Ember from 'ember'; /* global html_sanitize*/ import cajaSanitizers from 'ghost/utils/caja-sanitizers'; var formatHTML = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) { if (!arr || !arr.length) { return; } var escapedhtml = arr[0] || ''; // replace script and iFrame escapedhtml = escapedhtml.replace(/)<[^<]*)*<\/script>/gi, '
Embedded JavaScript
'); escapedhtml = escapedhtml.replace(/)<[^<]*)*<\/iframe>/gi, '
Embedded iFrame
'); // sanitize HTML // jscs:disable requireCamelCaseOrUpperCaseIdentifiers escapedhtml = html_sanitize(escapedhtml, cajaSanitizers.url, cajaSanitizers.id); // jscs:enable requireCamelCaseOrUpperCaseIdentifiers return Ember.String.htmlSafe(escapedhtml); }); export default formatHTML;