This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/iframed-html.js.es6
Mark VanLandingham ab133a7036 Merge pull request from GHSA-vw39-6w7q-gfx5
Co-authored-by: Robin Ward <robin.ward@gmail.com>
2020-02-27 11:50:03 -06:00

20 lines
475 B
JavaScript

import Component from "@ember/component";
export default Component.extend({
tagName: "iframe",
html: null,
className: "",
classNameBindings: ["html:iframed-html", "className"],
sandbox: "allow-same-origin",
attributeBindings: ['sandbox:sandbox'],
didRender() {
this._super(...arguments);
const iframeDoc = this.element.contentWindow.document;
iframeDoc.open("text/html", "replace");
iframeDoc.write(this.html);
iframeDoc.close();
}
});