X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bvideos%2F%2Bvideo-watch%2Fcomment%2Fvideo-comment-add.component.ts;h=0e1362ad38eb8b7da789ce3b4ec6d0f68c3091e3;hb=205e4f56f3da1f787f1bc2cdfcc39948a99a16b1;hp=c1d0032cc023193b7437d180d0685fc699fe4419;hpb=1e7eb457eda647b4fa22a0ae8e59c0a618f662f8;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts index c1d0032cc..0e1362ad3 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts @@ -43,9 +43,18 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, } get emojiMarkupList () { - const emojiMarkup = require('markdown-it-emoji/lib/data/light.json') + const emojiMarkupObjectList = require('markdown-it-emoji/lib/data/light.json') + + // Populate emoji-markup-list from object to array to avoid keys alphabetical order + const emojiMarkupArrayList = [] + for (const emojiMarkupName in emojiMarkupObjectList) { + if (emojiMarkupName) { + const emoji = emojiMarkupObjectList[emojiMarkupName] + emojiMarkupArrayList.push([emoji, emojiMarkupName]) + } + } - return emojiMarkup + return emojiMarkupArrayList } ngOnInit () { @@ -89,7 +98,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, openEmojiModal (event: any) { event.preventDefault() - this.modalService.open(this.emojiModal, { backdrop: true }) + this.modalService.open(this.emojiModal, { backdrop: true, size: 'lg' }) } hideModals () { @@ -134,11 +143,6 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, return window.location.href } - getAvatarUrl () { - if (this.user) return this.user.accountAvatarUrl - return window.location.origin + '/client/assets/images/default-avatar.png' - } - gotoLogin () { this.hideModals() this.router.navigate([ '/login' ]) @@ -183,7 +187,11 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, this.textareaElement.nativeElement.focus() } + // Scroll to textarea this.textareaElement.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' }) + + // Use the native textarea autosize according to the text's break lines + this.textareaElement.nativeElement.dispatchEvent(new Event('input')) }) this.form.patchValue({ text })