|
// retoor <retoor@molodetz.nl>
|
|
|
|
import { Component } from "./Component.js";
|
|
import { contentRenderer } from "../ContentRenderer.js";
|
|
|
|
export class AppContent extends Component {
|
|
connectedCallback() {
|
|
if (this._rendered) {
|
|
return;
|
|
}
|
|
if (typeof DOMPurify === "undefined" || typeof marked === "undefined") {
|
|
window.addEventListener("load", () => this.connectedCallback(), { once: true });
|
|
return;
|
|
}
|
|
this._rendered = true;
|
|
this.classList.add("rendered-content");
|
|
contentRenderer.applyTo(this);
|
|
if (typeof hljs !== "undefined") {
|
|
this.querySelectorAll("pre code").forEach((block) => hljs.highlightElement(block));
|
|
}
|
|
}
|
|
}
|
|
|
|
customElements.define("dp-content", AppContent);
|