2019-03-25 19:38:15 -07:00
|
|
|
<template>
|
|
|
|
<div class="emoji-input">
|
2019-06-06 14:17:49 -07:00
|
|
|
<slot
|
2019-03-26 10:40:37 -07:00
|
|
|
:class="classname"
|
2019-03-25 19:38:15 -07:00
|
|
|
:value="value"
|
|
|
|
:placeholder="placeholder"
|
|
|
|
@input="onInput"
|
|
|
|
@click="setCaret"
|
|
|
|
@keyup="setCaret"
|
|
|
|
@keydown="onKeydown"
|
|
|
|
@keydown.down="cycleForward"
|
|
|
|
@keydown.up="cycleBackward"
|
|
|
|
@keydown.shift.tab="cycleBackward"
|
|
|
|
@keydown.tab="cycleForward"
|
|
|
|
@keydown.enter="replaceEmoji"
|
2019-06-06 14:17:49 -07:00
|
|
|
>
|
|
|
|
</slot>
|
2019-03-25 19:38:15 -07:00
|
|
|
<div class="autocomplete-panel" v-if="suggestions">
|
|
|
|
<div class="autocomplete-panel-body">
|
|
|
|
<div
|
2019-06-06 14:17:49 -07:00
|
|
|
v-for="(suggestion, index) in suggestions"
|
2019-03-25 19:38:15 -07:00
|
|
|
:key="index"
|
2019-06-06 14:17:49 -07:00
|
|
|
@click="replace(suggestion.replacement)"
|
2019-03-25 19:38:15 -07:00
|
|
|
class="autocomplete-item"
|
2019-06-06 14:17:49 -07:00
|
|
|
:class="{ highlighted: suggestion.highlighted }"
|
2019-03-25 19:38:15 -07:00
|
|
|
>
|
2019-06-06 14:17:49 -07:00
|
|
|
<span v-if="suggestion.img">
|
|
|
|
<img :src="suggestion.img" />
|
2019-03-25 19:38:15 -07:00
|
|
|
</span>
|
2019-06-06 14:17:49 -07:00
|
|
|
<span v-else>{{suggestion.replacement}}</span>
|
|
|
|
<span>{{suggestion.shortcode}}</span>
|
2019-03-25 19:38:15 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script src="./emoji-input.js"></script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import '../../_variables.scss';
|
|
|
|
|
|
|
|
.emoji-input {
|
|
|
|
.form-control {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|