fix not being able to see unicode emojis when there few of them when searching

on emoji-a-ton instances
This commit is contained in:
Henry Jameson 2019-11-08 21:28:51 +02:00
parent 9338c81f4a
commit a43f1614ca

View File

@ -77,13 +77,14 @@ const EmojiPicker = {
const scrollerBottom = target.scrollTop + target.clientHeight const scrollerBottom = target.scrollTop + target.clientHeight
const scrollerTop = target.scrollTop const scrollerTop = target.scrollTop
const scrollerMax = target.scrollHeight
// Loads more emoji when they come into view // Loads more emoji when they come into view
const approachingBottom = bottom - scrollerBottom < LOAD_EMOJI_MARGIN const approachingBottom = bottom - scrollerBottom < LOAD_EMOJI_MARGIN
// Always load when at the very top in case there's no scroll space yet // Always load when at the very top in case there's no scroll space yet
const atTop = scrollerTop < 5 const atTop = scrollerTop < 5
// Don't load when looking at unicode category // Don't load when looking at unicode category or at the very bottom
const bottomAboveViewport = bottom < scrollerTop const bottomAboveViewport = bottom < scrollerTop || scrollerBottom === scrollerMax
if (!bottomAboveViewport && (approachingBottom || atTop)) { if (!bottomAboveViewport && (approachingBottom || atTop)) {
this.loadEmoji() this.loadEmoji()
} }
@ -126,6 +127,7 @@ const EmojiPicker = {
watch: { watch: {
keyword () { keyword () {
this.customEmojiLoadAllConfirmed = false this.customEmojiLoadAllConfirmed = false
this.$refs['emoji-groups'].scrollTop = 0
this.onScroll() this.onScroll()
this.startEmojiLoad(true) this.startEmojiLoad(true)
} }