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
2020-03-12 13:29:55 -04:00

19 lines
474 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();
}
});