mapcomplete/UI/Base/FixedUiElement.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
602 B
TypeScript
Raw Normal View History

2021-06-12 02:58:32 +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 {
2021-11-30 22:50:48 +01:00
public readonly content: string
2020-06-24 00:35:19 +02:00
constructor(html: string) {
2021-06-12 02:58:32 +02:00
super()
2021-11-30 22:50:48 +01:00
this.content = html ?? ""
2020-06-24 00:35:19 +02:00
}
2020-07-20 18:24:00 +02:00
InnerRender(): string {
2021-11-30 22:50:48 +01:00
return this.content
2020-06-24 00:35:19 +02:00
}
AsMarkdown(): string {
2022-04-08 01:55:42 +02:00
if (this.HasClass("code")) {
return "`" + this.content + "`"
}
2021-11-30 22:50:48 +01:00
return this.content
}
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
2021-06-12 02:58:32 +02:00
return e
}
2020-06-24 00:35:19 +02:00
}