Skip to content

Commit

Permalink
Improve markdown-it emoji list column display (Chocobozzz#3253)
Browse files Browse the repository at this point in the history
Co-authored-by: kimsible <kimsible@users.noreply.github.com>
Co-authored-by: Rigel Kent <sendmemail@rigelk.eu>
  • Loading branch information
3 people authored and fflorent committed Dec 31, 2020
1 parent a0bb002 commit 8dcfb4d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,10 @@ <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 class="emoji-flex">
<div class="emoji-flex-item" *ngFor="let emojiMarkup of emojiMarkupList">
{{ emojiMarkup[0] }} <code>:{{ emojiMarkup[1] }}:</code>
</div>
</div>
</div>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,22 @@ form {
}
}

.table-emoji {
td {
&:first-child {
width: 20px;
.emoji-flex {
display: flex;
flex-flow: row wrap;
align-items: center;

.emoji-flex-item {
text-align: left;
margin: auto;
min-width: 227px;
flex: 1;

code {
display: inline-block;
vertical-align: middle;
margin-left: 5px;
}

vertical-align: top;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit 8dcfb4d

Please sign in to comment.