2018-04-05 05:33:17 +02:00
|
|
|
<ModalDialog
|
2018-05-02 02:05:36 +02:00
|
|
|
{id}
|
|
|
|
{label}
|
|
|
|
{title}
|
2018-04-05 05:33:17 +02:00
|
|
|
background="var(--main-bg)"
|
|
|
|
>
|
2018-02-28 08:18:07 +01:00
|
|
|
<div class="custom-emoji-container">
|
2018-05-02 02:05:36 +02:00
|
|
|
{#if emojis.length}
|
2018-02-28 08:18:07 +01:00
|
|
|
<ul class="custom-emoji-list">
|
2018-05-02 02:05:36 +02:00
|
|
|
{#each emojis as emoji}
|
2018-02-28 08:18:07 +01:00
|
|
|
<li class="custom-emoji">
|
|
|
|
<button type="button" on:click="onClickEmoji(emoji)">
|
2018-05-02 02:05:36 +02:00
|
|
|
<img src={$autoplayGifs ? emoji.url : emoji.static_url}
|
|
|
|
alt=":{emoji.shortcode}:"
|
|
|
|
title=":{emoji.shortcode}:"
|
2018-02-28 08:18:07 +01:00
|
|
|
/>
|
|
|
|
</button>
|
|
|
|
</li>
|
2018-05-02 02:05:36 +02:00
|
|
|
{/each}
|
2018-02-28 08:18:07 +01:00
|
|
|
</ul>
|
2018-05-02 02:05:36 +02:00
|
|
|
{:else}
|
2018-02-28 08:18:07 +01:00
|
|
|
<div class="custom-emoji-no-emoji">No custom emoji found for this instance.</div>
|
2018-05-02 02:05:36 +02:00
|
|
|
{/if}
|
2018-02-28 08:18:07 +01:00
|
|
|
</div>
|
|
|
|
</ModalDialog>
|
|
|
|
<style>
|
|
|
|
.custom-emoji-container {
|
|
|
|
max-width: 100%;
|
|
|
|
width: 400px;
|
|
|
|
height: 300px;
|
2018-04-02 08:41:35 +02:00
|
|
|
overflow: auto;
|
2018-02-28 08:18:07 +01:00
|
|
|
}
|
|
|
|
.custom-emoji-no-emoji {
|
|
|
|
font-size: 1.3em;
|
|
|
|
padding: 20px;
|
|
|
|
}
|
|
|
|
.custom-emoji-list {
|
|
|
|
list-style: none;
|
|
|
|
display: grid;
|
2018-03-01 03:45:29 +01:00
|
|
|
grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
|
2018-02-28 08:18:07 +01:00
|
|
|
grid-gap: 5px;
|
|
|
|
padding: 20px 10px;
|
|
|
|
}
|
|
|
|
.custom-emoji button {
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
border: none;
|
|
|
|
cursor: pointer;
|
|
|
|
box-shadow: none;
|
|
|
|
background: none;
|
|
|
|
}
|
|
|
|
.custom-emoji img {
|
|
|
|
width: 48px;
|
|
|
|
height: 48px;
|
|
|
|
object-fit: contain;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import ModalDialog from './ModalDialog.html'
|
2018-04-09 01:56:20 +02:00
|
|
|
import { store } from '../../../_store/store'
|
|
|
|
import { insertEmoji } from '../../../_actions/emoji'
|
|
|
|
import { show } from '../helpers/showDialog'
|
|
|
|
import { close } from '../helpers/closeDialog'
|
|
|
|
import { oncreate } from '../helpers/onCreateDialog'
|
2018-02-28 08:18:07 +01:00
|
|
|
|
|
|
|
export default {
|
2018-04-09 01:56:20 +02:00
|
|
|
oncreate,
|
2018-02-28 08:18:07 +01:00
|
|
|
components: {
|
|
|
|
ModalDialog
|
|
|
|
},
|
|
|
|
store: () => store,
|
|
|
|
computed: {
|
2018-05-02 02:05:36 +02:00
|
|
|
emojis: ({ $currentCustomEmoji }) => {
|
2018-02-28 08:18:07 +01:00
|
|
|
if (!$currentCustomEmoji) {
|
|
|
|
return []
|
|
|
|
}
|
|
|
|
return $currentCustomEmoji.filter(emoji => emoji.visible_in_picker)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2018-04-09 01:56:20 +02:00
|
|
|
show,
|
|
|
|
close,
|
2018-04-20 06:38:01 +02:00
|
|
|
onClickEmoji (emoji) {
|
2018-04-19 18:37:05 +02:00
|
|
|
let { realm } = this.get()
|
|
|
|
insertEmoji(realm, emoji)
|
2018-04-09 01:56:20 +02:00
|
|
|
this.close()
|
2018-02-28 08:18:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|