X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-forms%2Fmarkdown-textarea.component.ts;h=dcb5d20daca791d0fd1beef0dff22e0621edab92;hb=8d8a037e3fe9b1d2ccbc4169ce59b13000b59cb0;hp=a233a42050cb348daa5137742a3bfacb349565bf;hpb=2539932e16129992a2c0889b4ff527c265a8e2c7;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-forms/markdown-textarea.component.ts b/client/src/app/shared/shared-forms/markdown-textarea.component.ts index a233a4205..dcb5d20da 100644 --- a/client/src/app/shared/shared-forms/markdown-textarea.component.ts +++ b/client/src/app/shared/shared-forms/markdown-textarea.component.ts @@ -6,6 +6,7 @@ import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@an import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' import { SafeHtml } from '@angular/platform-browser' import { MarkdownService, ScreenService } from '@app/core' +import { Video } from '@shared/models' @Component({ selector: 'my-markdown-textarea', @@ -33,7 +34,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit { @Input() markdownType: 'text' | 'enhanced' = 'text' @Input() customMarkdownRenderer?: (text: string) => Promise - @Input() markdownVideo = false + @Input() markdownVideo: Video @Input() name = 'description' @@ -44,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` @@ -107,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') @@ -131,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) @@ -147,7 +151,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit { } if (this.markdownVideo) { - html = this.markdownService.processVideoTimestamps(html) + html = this.markdownService.processVideoTimestamps(this.markdownVideo.shortUUID, html) } return html