| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | import BaseUIElement from "../BaseUIElement" | 
					
						
							| 
									
										
										
										
											2022-04-30 00:18:47 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export class Paragraph extends BaseUIElement { | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |     public readonly content: string | BaseUIElement | 
					
						
							| 
									
										
										
										
											2022-04-30 00:18:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |     constructor(html: string | BaseUIElement) { | 
					
						
							|  |  |  |         super() | 
					
						
							|  |  |  |         this.content = html ?? "" | 
					
						
							| 
									
										
										
										
											2022-04-30 00:18:47 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     AsMarkdown(): string { | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |         let c: string | 
					
						
							|  |  |  |         if (typeof this.content !== "string") { | 
					
						
							|  |  |  |             c = this.content.AsMarkdown() | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             c = this.content | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         return "\n\n" + c + "\n\n" | 
					
						
							| 
									
										
										
										
											2022-04-30 00:18:47 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     protected InnerConstructElement(): HTMLElement { | 
					
						
							|  |  |  |         const e = document.createElement("p") | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |         if (typeof this.content !== "string") { | 
					
						
							| 
									
										
										
										
											2022-04-30 00:18:47 +02:00
										 |  |  |             e.appendChild(this.content.ConstructElement()) | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2022-04-30 00:18:47 +02:00
										 |  |  |             e.innerHTML = this.content | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |         return e | 
					
						
							| 
									
										
										
										
											2022-04-30 00:18:47 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | } |