1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-19 18:47:03 +00:00

ui: Use web components to render server-side HTML

This commit is contained in:
James Hillyerd
2018-11-17 19:09:19 -08:00
parent f2cd3f92da
commit abd9ebeb35
5 changed files with 29 additions and 112 deletions

24
ui/src/renderedHtml.js Normal file
View File

@@ -0,0 +1,24 @@
// This element allows Inbucket to draw server rendered HTML, aka HTML email.
// https://leveljournal.com/server-rendered-html-in-elm
customElements.define(
"rendered-html",
class RenderedHtml extends HTMLElement {
constructor() {
super()
this._content = ""
}
set content(value) {
if (this._content === value) {
return
}
this._content = value
this.innerHTML = value
}
get content() {
return this._content
}
}
)