From 8872b4802e2b0dff25eaaf884884d740ed016c98 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sat, 8 Jun 2019 16:23:58 +0300
Subject: standartized autocomplete panel suggesions format, fixed some bugs

---
 src/components/emoji-input/emoji-input.vue | 64 +++++++++++++++---------------
 1 file changed, 32 insertions(+), 32 deletions(-)

(limited to 'src/components/emoji-input/emoji-input.vue')

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>
-- 
cgit v1.2.3-70-g09d2

