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
@Input() markdownType: 'text' | 'enhanced' = 'text'
@Input() customMarkdownRenderer?: (text: string) => Promise<string | HTMLElement>
+ @Input() debounceTime = 150
+
@Input() markdownVideo: Video
@Input() name = 'description'
previewHTML: SafeHtml | string = ''
isMaximized = false
+ disabled = false
maximizeInText = $localize`Maximize editor`
maximizeOutText = $localize`Exit maximized editor`
ngOnInit () {
this.contentChanged
.pipe(
- debounceTime(150),
+ debounceTime(this.debounceTime),
distinctUntilChanged()
)
.subscribe(() => this.updatePreviews())
}
onMaximizeClick () {
+ if (this.disabled) return
+
this.isMaximized = !this.isMaximized
// Make sure textarea have the focus
}
}
+ setDisabledState (isDisabled: boolean) {
+ this.disabled = isDisabled
+ }
+
private lockBodyScroll () {
this.scrollPosition = this.viewportScroller.getScrollPosition()
document.getElementById('content').classList.add('lock-scroll')
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) {