forked from MapComplete/MapComplete
Refactoring: move all code files into a src directory
This commit is contained in:
parent
de99f56ca8
commit
e75d2789d2
389 changed files with 0 additions and 12 deletions
33
src/UI/Base/FixedUiElement.ts
Normal file
33
src/UI/Base/FixedUiElement.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import BaseUIElement from "../BaseUIElement"
|
||||
|
||||
export class FixedUiElement extends BaseUIElement {
|
||||
public readonly content: string
|
||||
|
||||
constructor(html: string) {
|
||||
super()
|
||||
this.content = html ?? ""
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
return this.content
|
||||
}
|
||||
|
||||
AsMarkdown(): string {
|
||||
if (this.HasClass("code")) {
|
||||
if (this.content.indexOf("\n") > 0 || this.HasClass("block")) {
|
||||
return "\n```\n" + this.content + "\n```\n"
|
||||
}
|
||||
return "`" + this.content + "`"
|
||||
}
|
||||
if (this.HasClass("font-bold")) {
|
||||
return "*" + this.content + "*"
|
||||
}
|
||||
return this.content
|
||||
}
|
||||
|
||||
protected InnerConstructElement(): HTMLElement {
|
||||
const e = document.createElement("span")
|
||||
e.innerHTML = this.content
|
||||
return e
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue