2021-02-21 13:40:16 +00:00
|
|
|
class HtmlEmail extends HTMLElement {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.attachShadow({ mode: 'open' });
|
|
|
|
|
|
|
|
let emailContent;
|
2021-11-07 13:56:54 +00:00
|
|
|
const templateId = this.dataset.templateId;
|
2021-02-21 13:40:16 +00:00
|
|
|
try {
|
2021-11-07 13:56:54 +00:00
|
|
|
emailContent = document.getElementById(templateId).innerHTML;
|
2021-02-21 13:40:16 +00:00
|
|
|
} catch (error) {
|
|
|
|
console.log(error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const container = document.createElement('div');
|
|
|
|
container.innerHTML = emailContent;
|
|
|
|
|
|
|
|
this.shadowRoot.appendChild(container);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
customElements.define('html-email', HtmlEmail);
|