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/widgets/raw-html.js
2020-03-12 13:29:55 -04:00

30 lines
509 B
JavaScript

export default class RawHtml {
constructor(attrs) {
this.html = attrs.html;
}
init() {
const $html = $(this.html);
this.decorate($html);
return $html[0];
}
decorate() {}
update(prev) {
if (prev.html === this.html) {
return;
}
return this.init();
}
destroy() {}
}
RawHtml.prototype.type = "Widget";
// TODO: Improve how helpers are registered for vdom compliation
if (typeof Discourse !== "undefined") {
Discourse.__widget_helpers.rawHtml = RawHtml;
}