aboutsummaryrefslogtreecommitdiff
path: root/src/components/emoji-input/emoji-input.vue
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2019-06-08 16:23:58 +0300
committerHenry Jameson <me@hjkos.com>2019-06-08 16:23:58 +0300
commit8872b4802e2b0dff25eaaf884884d740ed016c98 (patch)
tree838506a0073ee82f0f12a6227fc995e8dc48d186 /src/components/emoji-input/emoji-input.vue
parentca3140fd3ed1ce4522c04d445de42d721a0fbc87 (diff)
standartized autocomplete panel suggesions format, fixed some bugs
Diffstat (limited to 'src/components/emoji-input/emoji-input.vue')
-rw-r--r--src/components/emoji-input/emoji-input.vue64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/components/emoji-input/emoji-input.vue b/src/components/emoji-input/emoji-input.vue
index eec33d1a..0ca74322 100644
--- a/src/components/emoji-input/emoji-input.vue
+++ b/src/components/emoji-input/emoji-input.vue
@@ -1,38 +1,25 @@
<template>
- <div class="emoji-input">
- <slot
- :class="classname"
- :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"
- >
- </slot>
- <div class="autocomplete-panel" v-if="suggestions">
- <div class="autocomplete-panel-body">
- <div
- v-for="(suggestion, index) in suggestions"
- :key="index"
- @click="replace(suggestion.replacement)"
- class="autocomplete-item"
- :class="{ highlighted: suggestion.highlighted }"
+<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 }"
>
- <span v-if="suggestion.img">
- <img :src="suggestion.img" />
- </span>
- <span v-else>{{suggestion.replacement}}</span>
- <span>{{suggestion.shortcode}}</span>
+ <span v-if="suggestion.img">
+ <img :src="suggestion.img" />
+ </span>
+ <span v-else>{{suggestion.replacement}}</span>
+ <span>{{suggestion.displayText}}</span>
+ <span>{{suggestion.detailText}}</span>
</div>
- </div>
</div>
</div>
+</div>
</template>
<script src="./emoji-input.js"></script>
@@ -41,8 +28,21 @@
@import '../../_variables.scss';
.emoji-input {
- .form-control {
- width: 100%;
+ display: flex;
+ flex-direction: column;
+
+ &.hide {
+ display: none
+ }
+
+ .autocomplete-panel {
+ position: absolute;
+ z-index: 9;
+ margin-top: 2px;
+ }
+
+ input, textarea {
+ flex: 1;
}
}
</style>