2019-03-26 13:38:15 +11:00
|
|
|
<template>
|
2019-06-08 23:23:58 +10:00
|
|
|
<div class="emoji-input">
|
|
|
|
<slot></slot>
|
|
|
|
<div ref="panel" class="autocomplete-panel" :class="{ hide: suggestions}">
|
|
|
|
<div class="autocomplete-panel-body">
|
|
|
|
<div
|
|
|
|
v-for="(suggestion, index) in suggestions"
|
|
|
|
:key="index"
|
|
|
|
@click.stop.prevent="replace(suggestion.replacement)"
|
|
|
|
class="autocomplete-item"
|
|
|
|
:class="{ highlighted: suggestion.highlighted }"
|
2019-03-26 13:38:15 +11:00
|
|
|
>
|
2019-06-08 23:23:58 +10:00
|
|
|
<span v-if="suggestion.img">
|
|
|
|
<img :src="suggestion.img" />
|
|
|
|
</span>
|
|
|
|
<span v-else>{{suggestion.replacement}}</span>
|
|
|
|
<span>{{suggestion.displayText}}</span>
|
|
|
|
<span>{{suggestion.detailText}}</span>
|
2019-03-26 13:38:15 +11:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-06-08 23:23:58 +10:00
|
|
|
</div>
|
2019-03-26 13:38:15 +11:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script src="./emoji-input.js"></script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import '../../_variables.scss';
|
|
|
|
|
|
|
|
.emoji-input {
|
2019-06-08 23:23:58 +10:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
&.hide {
|
|
|
|
display: none
|
|
|
|
}
|
|
|
|
|
|
|
|
.autocomplete-panel {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 9;
|
|
|
|
margin-top: 2px;
|
|
|
|
}
|
|
|
|
|
|
|
|
input, textarea {
|
|
|
|
flex: 1;
|
2019-03-26 13:38:15 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|