]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-forms/markdown-textarea.component.ts
Fix HTML in account/channel description
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-forms / markdown-textarea.component.ts
index 8f51d47df638a7ae21f869a1423ba043fc996f80..e3371f22c7592b594f58f9e7551758020fe8a12d 100644 (file)
@@ -24,10 +24,7 @@ import { Video } from '@shared/models'
 export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
   @Input() content = ''
 
-  @Input() classes: string[] | { [klass: string]: any[] | any } = []
-
-  @Input() textareaMaxWidth = '100%'
-  @Input() textareaHeight = '150px'
+  @Input() formError: string
 
   @Input() truncate: number
 
@@ -45,6 +42,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
   previewHTML: SafeHtml | string = ''
 
   isMaximized = false
+  disabled = false
 
   maximizeInText = $localize`Maximize editor`
   maximizeOutText = $localize`Exit maximized editor`
@@ -92,6 +90,8 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
   }
 
   onMaximizeClick () {
+    if (this.disabled) return
+
     this.isMaximized = !this.isMaximized
 
     // Make sure textarea have the focus
@@ -108,6 +108,10 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
     }
   }
 
+  setDisabledState (isDisabled: boolean) {
+    this.disabled = isDisabled
+  }
+
   private lockBodyScroll () {
     this.scrollPosition = this.viewportScroller.getScrollPosition()
     document.getElementById('content').classList.add('lock-scroll')
@@ -132,8 +136,6 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
       const result = await this.customMarkdownRenderer(text)
 
       if (result instanceof HTMLElement) {
-        html = ''
-
         const wrapperElement = this.previewElement.nativeElement as HTMLElement
         wrapperElement.innerHTML = ''
         wrapperElement.appendChild(result)
@@ -142,9 +144,9 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
 
       html = result
     } else if (this.markdownType === 'text') {
-      html = await this.markdownService.textMarkdownToHTML(text)
+      html = await this.markdownService.textMarkdownToHTML({ markdown: text })
     } else {
-      html = await this.markdownService.enhancedMarkdownToHTML(text)
+      html = await this.markdownService.enhancedMarkdownToHTML({ markdown: text })
     }
 
     if (this.markdownVideo) {