Add paragraph and wikipedia options

This commit is contained in:
Pieter Vander Vennet 2022-04-30 00:18:47 +02:00
parent 8b06ca77f9
commit 73cec987c9
4 changed files with 72 additions and 21 deletions

33
UI/Base/Paragraph.ts Normal file
View file

@ -0,0 +1,33 @@
import BaseUIElement from "../BaseUIElement";
export class Paragraph extends BaseUIElement {
public readonly content: (string | BaseUIElement);
constructor(html: (string | BaseUIElement)) {
super();
this.content = html ?? "";
}
AsMarkdown(): string {
let c:string ;
if(typeof this.content !== "string"){
c = this.content.AsMarkdown()
}else{
c = this.content
}
return "\n\n"+c+"\n\n"
}
protected InnerConstructElement(): HTMLElement {
const e = document.createElement("p")
if(typeof this.content !== "string"){
e.appendChild(this.content.ConstructElement())
}else{
e.innerHTML = this.content
}
return e;
}
}