Skip to content

A platform for community discussion. Free, open, simple.

DEV: Modernise CustomHtml implementation (#20266)

David Taylor87f9583dcf91
diff --git a/app/assets/javascripts/discourse/app/components/custom-html-container.js b/app/assets/javascripts/discourse/app/components/custom-html-container.js
deleted file mode 100644
index 87d5ddb040f..00000000000
--- a/app/assets/javascripts/discourse/app/components/custom-html-container.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import Component from "@ember/component";
-
-export default Component.extend({});
diff --git a/app/assets/javascripts/discourse/app/components/custom-html.js b/app/assets/javascripts/discourse/app/components/custom-html.js
index a532abf6bc5..e8703a19898 100644
--- a/app/assets/javascripts/discourse/app/components/custom-html.js
+++ b/app/assets/javascripts/discourse/app/components/custom-html.js
@@ -1,6 +1,7 @@
import Component from "@ember/component";
import { getCustomHTML } from "discourse/helpers/custom-html";
import { getOwner } from "discourse-common/lib/get-owner";
+import { hbs } from "ember-cli-htmlbars";
import deprecated from "discourse-common/lib/deprecated";
export default Component.extend({
@@ -13,7 +14,7 @@ export default Component.extend({
if (html) {
this.set("html", html);
- this.set("layoutName", "components/custom-html-container");
+ this.set("layout", hbs`{{this.html}}`);
} else {
const template = getOwner(this).lookup(`template:${name}`);
if (template) {
@@ -21,7 +22,7 @@ export default Component.extend({
"Defining an hbs template for CustomHTML rendering is deprecated. Use plugin outlets instead.",
{ id: "discourse.custom_html_template" }
);
- this.set("layoutName", name);
+ this.set("layout", template);
}
}
},
diff --git a/app/assets/javascripts/discourse/app/templates/components/custom-html-container.hbs b/app/assets/javascripts/discourse/app/templates/components/custom-html-container.hbs
deleted file mode 100644
index 63db710e363..00000000000
--- a/app/assets/javascripts/discourse/app/templates/components/custom-html-container.hbs
+++ /dev/null
@@ -1 +0,0 @@
-{{this.html}}
\ No newline at end of file