Use StillImage to render emojis in emoji picker

This commit is contained in:
Tusooa Zhu 2022-01-08 01:35:16 -05:00
commit b77259a9a0
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
4 changed files with 36 additions and 8 deletions

View file

@ -118,8 +118,19 @@ const EmojiPicker = {
},
initializeLazyLoad () {
this.destroyLazyLoad()
this.$lozad = lozad('img', {})
this.$lozad.observe()
this.$nextTick(() => {
this.$lozad = lozad('.still-image.emoji-picker-emoji', {
load: el => {
const vn = el.__vue__
if (!vn) {
return
}
vn.loadLazy()
}
})
this.$lozad.observe()
})
},
waitForDomAndInitializeLazyLoad () {
this.$nextTick(() => this.initializeLazyLoad())

View file

@ -89,10 +89,11 @@
@click.stop.prevent="onEmoji(emoji)"
>
<span v-if="!emoji.imageUrl">{{ emoji.replacement }}</span>
<img
<still-image
v-else
class="emoji-picker-emoji"
:data-src="emoji.imageUrl"
>
/>
</span>
<span :ref="'group-end-' + group.id" />
</div>