logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

emoji_picker.vue (5592B)


  1. <template>
  2. <Popover
  3. ref="popover"
  4. trigger="click"
  5. popover-class="emoji-picker popover-default"
  6. :trigger-attrs="{ 'aria-hidden': true, tabindex: -1 }"
  7. @show="onPopoverShown"
  8. @close="onPopoverClosed"
  9. >
  10. <template #content>
  11. <div
  12. class="heading"
  13. >
  14. <div class="emoji-search">
  15. <input
  16. ref="search"
  17. v-model="keyword"
  18. type="text"
  19. class="input form-control"
  20. :placeholder="$t('emoji.search_emoji')"
  21. @input="$event.target.composing = false"
  22. >
  23. </div>
  24. <!--
  25. Body scroll lock needs to be on every scrollable element on safari iOS.
  26. Here we tell it to enable scrolling for this element.
  27. See https://github.com/willmcpo/body-scroll-lock#vanilla-js
  28. -->
  29. <span
  30. ref="header"
  31. v-body-scroll-lock="isInModal"
  32. class="emoji-tabs"
  33. @wheel.prevent="groupScroll"
  34. >
  35. <span
  36. v-for="group in filteredEmojiGroups"
  37. :ref="setGroupRef('group-header-' + group.id)"
  38. :key="group.id"
  39. class="button-unstyled emoji-tabs-item"
  40. :class="{
  41. toggled: activeGroupView === group.id
  42. }"
  43. :title="group.text"
  44. role="button"
  45. @click.prevent="highlight(group.id)"
  46. >
  47. <span
  48. v-if="group.image"
  49. class="emoji-picker-header-image"
  50. >
  51. <still-image
  52. :alt="group.text"
  53. :src="group.image"
  54. />
  55. </span>
  56. <FAIcon
  57. v-else
  58. :icon="group.icon"
  59. fixed-width
  60. />
  61. </span>
  62. </span>
  63. <span
  64. v-if="stickerPickerEnabled"
  65. class="additional-tabs"
  66. >
  67. <span
  68. class="button-unstyled stickers-tab-icon additional-tabs-item"
  69. :class="{toggled: showingStickers}"
  70. :title="$t('emoji.stickers')"
  71. @click.prevent="toggleStickers"
  72. >
  73. <FAIcon
  74. icon="sticky-note"
  75. fixed-width
  76. />
  77. </span>
  78. </span>
  79. </div>
  80. <div
  81. v-if="contentLoaded"
  82. class="content"
  83. >
  84. <div
  85. class="emoji-content"
  86. :class="{hidden: showingStickers}"
  87. >
  88. <!-- Enables scrolling for this element on safari iOS. See comments for header. -->
  89. <DynamicScroller
  90. ref="emoji-groups"
  91. v-body-scroll-lock="isInModal"
  92. class="emoji-groups"
  93. :class="groupsScrolledClass"
  94. :min-item-size="minItemSize"
  95. :buffer="minItemSize"
  96. :items="emojiItems"
  97. :emit-update="true"
  98. @update="onScroll"
  99. @visible="recalculateItemPerRow"
  100. @resize="recalculateItemPerRow"
  101. >
  102. <template #default="{ item: group, index, active }">
  103. <DynamicScrollerItem
  104. :ref="setGroupRef('group-' + group.id)"
  105. :item="group"
  106. :active="active"
  107. :data-index="index"
  108. :size-dependencies="[group.emojis.length]"
  109. >
  110. <div
  111. class="emoji-group"
  112. :class="{ ['first-row']: group.isFirstRow }"
  113. :style="{ '--__amount': itemPerRow }"
  114. >
  115. <h6
  116. v-if="group.isFirstRow"
  117. class="emoji-group-title"
  118. >
  119. {{ group.text }}
  120. </h6>
  121. <span
  122. v-for="emoji in group.emojis"
  123. :key="group.id + emoji.displayText"
  124. :title="maybeLocalizedEmojiName(emoji)"
  125. class="emoji-item"
  126. role="button"
  127. @click.stop.prevent="onEmoji(emoji)"
  128. >
  129. <span
  130. v-if="!emoji.imageUrl"
  131. class="emoji-picker-emoji -unicode"
  132. >{{ emoji.replacement }}</span>
  133. <still-image
  134. v-else
  135. class="emoji-picker-emoji -custom"
  136. loading="lazy"
  137. :alt="maybeLocalizedEmojiName(emoji)"
  138. :src="emoji.imageUrl"
  139. :data-emoji-name="group.id + emoji.displayText"
  140. />
  141. </span>
  142. </div>
  143. </DynamicScrollerItem>
  144. </template>
  145. </DynamicScroller>
  146. <div class="keep-open">
  147. <Checkbox v-model="keepOpen">
  148. {{ $t('emoji.keep_open') }}
  149. </Checkbox>
  150. </div>
  151. <div
  152. v-if="!hideCustomEmoji"
  153. class="hide-custom-emoji"
  154. >
  155. <Checkbox
  156. v-model="hideCustomEmojiInPicker"
  157. @change="onShowing"
  158. >
  159. {{ $t('emoji.hide_custom_emoji') }}
  160. </Checkbox>
  161. </div>
  162. </div>
  163. <div
  164. v-if="showingStickers"
  165. class="stickers-content"
  166. >
  167. <sticker-picker
  168. @uploaded="onStickerUploaded"
  169. @upload-failed="onStickerUploadFailed"
  170. />
  171. </div>
  172. </div>
  173. </template>
  174. </Popover>
  175. </template>
  176. <script src="./emoji_picker.js"></script>
  177. <style lang="scss" src="./emoji_picker.scss"></style>