mirror of
https://github.com/cytopia/devilbox.git
synced 2024-12-28 16:48:51 +00:00
23 lines
521 B
JavaScript
23 lines
521 B
JavaScript
class HtmlEmail extends HTMLElement {
|
|
constructor() {
|
|
super();
|
|
this.attachShadow({ mode: 'open' });
|
|
|
|
let emailContent;
|
|
const templateId = this.dataset.templateId;
|
|
try {
|
|
emailContent = document.getElementById(templateId).innerHTML;
|
|
} catch (error) {
|
|
console.log(error);
|
|
return;
|
|
}
|
|
|
|
const container = document.createElement('div');
|
|
container.innerHTML = emailContent;
|
|
|
|
this.shadowRoot.appendChild(container);
|
|
}
|
|
}
|
|
|
|
customElements.define('html-email', HtmlEmail);
|