Display emoji in the preview
Consistency with the video description
This commit is contained in:
parent
68b7a69f99
commit
40a498790e
|
@ -55,7 +55,7 @@
|
||||||
|
|
||||||
<my-markdown-textarea
|
<my-markdown-textarea
|
||||||
formControlName="description" [markdownVideo]="publishedVideo"
|
formControlName="description" [markdownVideo]="publishedVideo"
|
||||||
[formError]="formErrors.description" [truncateTo3Lines]="true"
|
[formError]="formErrors.description" truncateTo3Lines="true" withEmoji="true"
|
||||||
></my-markdown-textarea>
|
></my-markdown-textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { Subject } from 'rxjs'
|
import { NgClass, NgIf, ViewportScroller } from '@angular/common'
|
||||||
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'
|
import { booleanAttribute, Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@angular/core'
|
||||||
import { ViewportScroller, NgClass, NgIf } from '@angular/common'
|
import { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms'
|
||||||
import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@angular/core'
|
|
||||||
import { ControlValueAccessor, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms'
|
|
||||||
import { SafeHtml } from '@angular/platform-browser'
|
import { SafeHtml } from '@angular/platform-browser'
|
||||||
import { MarkdownService, ScreenService } from '@app/core'
|
import { MarkdownService, ScreenService } from '@app/core'
|
||||||
|
import { NgbNav, NgbNavContent, NgbNavItem, NgbNavLink, NgbNavLinkBase, NgbNavOutlet, NgbTooltip } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { Video } from '@peertube/peertube-models'
|
import { Video } from '@peertube/peertube-models'
|
||||||
import { FormReactiveErrors } from './form-reactive.service'
|
import { Subject } from 'rxjs'
|
||||||
|
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'
|
||||||
import { GlobalIconComponent } from '../shared-icons/global-icon.component'
|
import { GlobalIconComponent } from '../shared-icons/global-icon.component'
|
||||||
import { NgbNav, NgbNavItem, NgbNavLink, NgbNavLinkBase, NgbNavContent, NgbTooltip, NgbNavOutlet } from '@ng-bootstrap/ng-bootstrap'
|
import { FormReactiveErrors } from './form-reactive.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-markdown-textarea',
|
selector: 'my-markdown-textarea',
|
||||||
|
@ -42,7 +42,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
|
||||||
|
|
||||||
@Input() formError: string | FormReactiveErrors | FormReactiveErrors[]
|
@Input() formError: string | FormReactiveErrors | FormReactiveErrors[]
|
||||||
|
|
||||||
@Input() truncateTo3Lines: boolean
|
@Input({ transform: booleanAttribute }) truncateTo3Lines: boolean
|
||||||
|
|
||||||
@Input() markdownType: 'text' | 'enhanced' | 'to-unsafe-html' = 'text'
|
@Input() markdownType: 'text' | 'enhanced' | 'to-unsafe-html' = 'text'
|
||||||
@Input() customMarkdownRenderer?: (text: string) => Promise<string | HTMLElement>
|
@Input() customMarkdownRenderer?: (text: string) => Promise<string | HTMLElement>
|
||||||
|
@ -54,6 +54,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
|
||||||
@Input() name = 'description'
|
@Input() name = 'description'
|
||||||
|
|
||||||
@Input() dir: string
|
@Input() dir: string
|
||||||
|
@Input({ transform: booleanAttribute }) withEmoji = false
|
||||||
|
|
||||||
@ViewChild('textarea') textareaElement: ElementRef
|
@ViewChild('textarea') textareaElement: ElementRef
|
||||||
@ViewChild('previewElement') previewElement: ElementRef
|
@ViewChild('previewElement') previewElement: ElementRef
|
||||||
|
@ -162,9 +163,9 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
|
||||||
|
|
||||||
html = result
|
html = result
|
||||||
} else if (this.markdownType === 'text') {
|
} else if (this.markdownType === 'text') {
|
||||||
html = await this.markdownService.textMarkdownToHTML({ markdown: text })
|
html = await this.markdownService.textMarkdownToHTML({ markdown: text, withEmoji: this.withEmoji })
|
||||||
} else if (this.markdownType === 'enhanced') {
|
} else if (this.markdownType === 'enhanced') {
|
||||||
html = await this.markdownService.enhancedMarkdownToHTML({ markdown: text })
|
html = await this.markdownService.enhancedMarkdownToHTML({ markdown: text, withEmoji: this.withEmoji })
|
||||||
} else if (this.markdownType === 'to-unsafe-html') {
|
} else if (this.markdownType === 'to-unsafe-html') {
|
||||||
html = await this.markdownService.markdownToUnsafeHTML({ markdown: text })
|
html = await this.markdownService.markdownToUnsafeHTML({ markdown: text })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue