2022-09-08 21:40:48 +02:00
|
|
|
import BaseUIElement from "../BaseUIElement"
|
2020-06-24 00:35:19 +02:00
|
|
|
|
2021-06-12 02:58:32 +02:00
|
|
|
export class FixedUiElement extends BaseUIElement {
|
2022-09-08 21:40:48 +02:00
|
|
|
public readonly content: string
|
2020-06-24 00:35:19 +02:00
|
|
|
|
|
|
|
constructor(html: string) {
|
2022-09-08 21:40:48 +02:00
|
|
|
super()
|
|
|
|
this.content = html ?? ""
|
2020-06-24 00:35:19 +02:00
|
|
|
}
|
2021-09-09 00:05:51 +02:00
|
|
|
|
2020-07-20 18:24:00 +02:00
|
|
|
InnerRender(): string {
|
2022-09-08 21:40:48 +02:00
|
|
|
return this.content
|
2020-06-24 00:35:19 +02:00
|
|
|
}
|
|
|
|
|
2021-09-09 00:05:51 +02:00
|
|
|
AsMarkdown(): string {
|
2022-09-08 21:40:48 +02:00
|
|
|
if (this.HasClass("code")) {
|
2023-02-12 22:58:21 +01:00
|
|
|
if (this.content.indexOf("\n") > 0 || this.HasClass("block")) {
|
|
|
|
return "\n```\n" + this.content + "\n```\n"
|
|
|
|
}
|
2022-09-08 21:40:48 +02:00
|
|
|
return "`" + this.content + "`"
|
2022-04-08 01:55:42 +02:00
|
|
|
}
|
2022-12-08 00:48:44 +01:00
|
|
|
if (this.HasClass("font-bold")) {
|
|
|
|
return "*" + this.content + "*"
|
|
|
|
}
|
2022-09-08 21:40:48 +02:00
|
|
|
return this.content
|
2021-09-09 00:05:51 +02:00
|
|
|
}
|
|
|
|
|
2021-06-12 02:58:32 +02:00
|
|
|
protected InnerConstructElement(): HTMLElement {
|
|
|
|
const e = document.createElement("span")
|
2021-11-30 22:50:48 +01:00
|
|
|
e.innerHTML = this.content
|
2022-09-08 21:40:48 +02:00
|
|
|
return e
|
2021-06-12 02:58:32 +02:00
|
|
|
}
|
2022-09-08 21:40:48 +02:00
|
|
|
}
|