Add emoji list to markdown infos
This commit is contained in:
parent
fd9c3c8d66
commit
ee3bd9db05
|
@ -3,12 +3,14 @@
|
||||||
<img [src]="getAvatarUrl()" alt="Avatar" />
|
<img [src]="getAvatarUrl()" alt="Avatar" />
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<textarea i18n-placeholder placeholder="Add comment..." myAutoResize [readonly]="(user === null) ? true : false"
|
<textarea i18n-placeholder placeholder="Add comment..." myAutoResize
|
||||||
(click)="openVisitorModal($event)" formControlName="text" [ngClass]="{ 'input-error': formErrors['text'] }"
|
[readonly]="(user === null) ? true : false"
|
||||||
(keyup.control.enter)="onValidKey()" (keyup.meta.enter)="onValidKey()" #textarea>
|
(click)="openVisitorModal($event)"
|
||||||
|
formControlName="text" [ngClass]="{ 'input-error': formErrors['text'] }"
|
||||||
|
(keyup.control.enter)="onValidKey()" (keyup.meta.enter)="onValidKey()" #textarea>
|
||||||
|
|
||||||
</textarea>
|
</textarea>
|
||||||
<my-help class="markdown-guide" helpType="custom" iconName="markdown" i18n-title title="Markdown compatible">
|
<my-help class="markdown-guide" helpType="custom" iconName="markdown" tooltipPlacement="left auto" i18n-title title="Markdown compatible">
|
||||||
<ng-template ptTemplate="customHtml">
|
<ng-template ptTemplate="customHtml">
|
||||||
<span i18n>Markdown compatible that supports:</span>
|
<span i18n>Markdown compatible that supports:</span>
|
||||||
|
|
||||||
|
@ -27,6 +29,7 @@
|
||||||
<li>
|
<li>
|
||||||
<span i18n>Emoji markup</span>
|
<span i18n>Emoji markup</span>
|
||||||
<code>:smile:</code>
|
<code>:smile:</code>
|
||||||
|
<div><a href="" (click)="openEmojiModal($event)" i18n>See complete list</a></div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
@ -50,7 +53,7 @@
|
||||||
<ng-template #visitorModal let-modal>
|
<ng-template #visitorModal let-modal>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="modal-basic-title" i18n>You are one step away from commenting</h4>
|
<h4 class="modal-title" id="modal-basic-title" i18n>You are one step away from commenting</h4>
|
||||||
<my-global-icon iconName="cross" aria-label="Close" role="button" (click)="hideVisitorModal()"></my-global-icon>
|
<my-global-icon iconName="cross" aria-label="Close" role="button" (click)="hideModals()"></my-global-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<span i18n>
|
<span i18n>
|
||||||
|
@ -66,7 +69,7 @@
|
||||||
<div class="modal-footer inputs">
|
<div class="modal-footer inputs">
|
||||||
<input
|
<input
|
||||||
type="button" role="button" i18n-value value="Cancel" class="action-button action-button-cancel"
|
type="button" role="button" i18n-value value="Cancel" class="action-button action-button-cancel"
|
||||||
(click)="hideVisitorModal()" (key.enter)="hideVisitorModal()"
|
(click)="hideModals()" (key.enter)="hideModals()"
|
||||||
>
|
>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
|
@ -75,3 +78,22 @@
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #emojiModal>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="modal-basic-title" i18n>Markdown Emoji List</h4>
|
||||||
|
<my-global-icon iconName="cross" aria-label="Close" role="button" (click)="hideModals()"></my-global-icon>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<table class="table-emoji" *ngFor="let emojiMarkup of emojiMarkupList | keyvalue">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<span>{{ emojiMarkup.value }}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<code>:{{ emojiMarkup.key }}:</code>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
|
|
@ -99,6 +99,16 @@ form {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table-emoji {
|
||||||
|
td {
|
||||||
|
&:first-child {
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 600px) {
|
@media screen and (max-width: 600px) {
|
||||||
textarea, .comment-buttons button {
|
textarea, .comment-buttons button {
|
||||||
font-size: 14px !important;
|
font-size: 14px !important;
|
||||||
|
|
|
@ -27,6 +27,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
|
||||||
@Output() cancel = new EventEmitter()
|
@Output() cancel = new EventEmitter()
|
||||||
|
|
||||||
@ViewChild('visitorModal', { static: true }) visitorModal: NgbModal
|
@ViewChild('visitorModal', { static: true }) visitorModal: NgbModal
|
||||||
|
@ViewChild('emojiModal', { static: true }) emojiModal: NgbModal
|
||||||
@ViewChild('textarea', { static: true }) textareaElement: ElementRef
|
@ViewChild('textarea', { static: true }) textareaElement: ElementRef
|
||||||
|
|
||||||
addingComment = false
|
addingComment = false
|
||||||
|
@ -44,6 +45,12 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get emojiMarkupList () {
|
||||||
|
const emojiMarkup = require('markdown-it-emoji/lib/data/light.json')
|
||||||
|
|
||||||
|
return emojiMarkup
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.buildForm({
|
this.buildForm({
|
||||||
text: this.videoCommentValidatorsService.VIDEO_COMMENT_TEXT
|
text: this.videoCommentValidatorsService.VIDEO_COMMENT_TEXT
|
||||||
|
@ -97,7 +104,12 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hideVisitorModal () {
|
openEmojiModal (event: any) {
|
||||||
|
event.preventDefault()
|
||||||
|
this.modalService.open(this.emojiModal, { backdrop: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
hideModals () {
|
||||||
this.modalService.dismissAll()
|
this.modalService.dismissAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +157,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
|
||||||
}
|
}
|
||||||
|
|
||||||
gotoLogin () {
|
gotoLogin () {
|
||||||
this.hideVisitorModal()
|
this.hideModals()
|
||||||
this.router.navigate([ '/login' ])
|
this.router.navigate([ '/login' ])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue