This commit is contained in:
Henry Jameson 2019-07-29 00:10:43 +03:00
parent 03c2f29b0a
commit fd66afe1e5
4 changed files with 60 additions and 33 deletions

View File

@ -67,7 +67,7 @@ const EmojiInput = {
caret: 0, caret: 0,
focused: false, focused: false,
blurTimeout: null, blurTimeout: null,
showPicker: false, showPicker: false
} }
}, },
components: { components: {

View File

@ -1,21 +1,21 @@
<template> <template>
<div <div
class="emoji-input"
v-click-outside="onClickOutside" v-click-outside="onClickOutside"
class="emoji-input"
> >
<slot /> <slot />
<template v-if="emojiPicker"> <template v-if="emojiPicker">
<div <div
@click.prevent="togglePicker"
class="emoji-picker-icon" class="emoji-picker-icon"
:class="pickerIconBottom ? 'picker-icon-bottom': 'picker-icon-right'" :class="pickerIconBottom ? 'picker-icon-bottom': 'picker-icon-right'"
@click.prevent="togglePicker"
> >
<i class="icon-smile"></i> <i class="icon-smile" />
</div> </div>
<EmojiPicker <EmojiPicker
v-if="emojiPicker" v-if="emojiPicker"
:class="{ hide: !showPicker }"
ref="picker" ref="picker"
:class="{ hide: !showPicker }"
class="emoji-picker-panel" class="emoji-picker-panel"
@emoji="insert" @emoji="insert"
/> />

View File

@ -1,17 +1,41 @@
<template> <template>
<div class="emoji-dropdown-menu panel panel-default"> <div class="emoji-dropdown-menu panel panel-default">
<div class="panel-heading emoji-tabs"> <div class="panel-heading emoji-tabs">
<span class="emoji-tabs-item" :class="{'active': activeGroup === key}" v-for="(value, key) in emojis" :key="key" :title="value.text" @click.prevent="highlight(key)"> <span
<i :class="value.icon"></i> v-for="(value, key) in emojis"
:key="key"
class="emoji-tabs-item"
:class="{'active': activeGroup === key}"
:title="value.text"
@click.prevent="highlight(key)"
>
<i :class="value.icon" />
</span> </span>
</div> </div>
<div class="panel-body emoji-dropdown-menu-content"> <div class="panel-body emoji-dropdown-menu-content">
<div class="emoji-search"> <div class="emoji-search">
<input type="text" class="form-control" v-model="keyword" /> <input
v-model="keyword"
type="text"
class="form-control"
>
</div> </div>
<div class="emoji-groups" ref="emoji-groups" @scroll="scrolledGroup"> <div
<div v-for="(value, key) in emojis" :key="key" class="emoji-group"> ref="emoji-groups"
<h6 class="emoji-group-title" :ref="'group-' + key">{{value.text}}</h6> class="emoji-groups"
@scroll="scrolledGroup"
>
<div
v-for="(value, key) in emojis"
:key="key"
class="emoji-group"
>
<h6
:ref="'group-' + key"
class="emoji-group-title"
>
{{ value.text }}
</h6>
<span <span
v-for="emoji in value.emojis" v-for="emoji in value.emojis"
:key="key + emoji.displayText" :key="key + emoji.displayText"
@ -20,7 +44,10 @@
@click="onEmoji(emoji)" @click="onEmoji(emoji)"
> >
<span v-if="!emoji.imageUrl">{{ emoji.replacement }}</span> <span v-if="!emoji.imageUrl">{{ emoji.replacement }}</span>
<img :src="emoji.imageUrl" v-else> <img
v-else
:src="emoji.imageUrl"
>
</span> </span>
</div> </div>
</div> </div>

View File

@ -61,7 +61,7 @@
<EmojiInput <EmojiInput
v-if="newStatus.spoilerText || alwaysShowSubject" v-if="newStatus.spoilerText || alwaysShowSubject"
v-model="newStatus.spoilerText" v-model="newStatus.spoilerText"
emojiPicker emoji-picker
:suggest="emojiSuggestor" :suggest="emojiSuggestor"
class="form-control" class="form-control"
> >
@ -76,7 +76,7 @@
<EmojiInput <EmojiInput
v-model="newStatus.status" v-model="newStatus.status"
:suggest="emojiUserSuggestor" :suggest="emojiUserSuggestor"
emojiPicker emoji-picker
class="form-control main-input" class="form-control main-input"
> >
<textarea <textarea