]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-forms/markdown-textarea.component.ts
Allow configuration to be static/readonly (#4315)
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-forms / markdown-textarea.component.ts
index 8f51d47df638a7ae21f869a1423ba043fc996f80..dcb5d20daca791d0fd1beef0dff22e0621edab92 100644 (file)
@@ -45,6 +45,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
   previewHTML: SafeHtml | string = ''
 
   isMaximized = false
+  disabled = false
 
   maximizeInText = $localize`Maximize editor`
   maximizeOutText = $localize`Exit maximized editor`
@@ -108,6 +109,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 +137,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)