diff --git a/package.json b/package.json
index 8960bf3b..fdc3105d 100644
--- a/package.json
+++ b/package.json
@@ -38,7 +38,6 @@
"vue-i18n": "^7.3.2",
"vue-router": "^3.0.1",
"vue-template-compiler": "^2.6.11",
- "vue-virtual-scroller": "^1.1.2",
"vuelidate": "^0.7.4",
"vuex": "^3.0.1"
},
diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index 861f576e..cc0c7c5e 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -2,7 +2,6 @@ import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import App from '../App.vue'
-import VueVirtualScroller from 'vue-virtual-scroller'
import { windowWidth } from '../services/window_utils/window_utils'
import { getOrCreateApp, getClientToken } from '../services/new_api/oauth.js'
import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js'
@@ -378,18 +377,14 @@ const afterStoreSetup = async ({ store, i18n }) => {
}
})
- let vue = new Vue({
+ /* eslint-disable no-new */
+ return new Vue({
router,
store,
i18n,
el: '#app',
render: h => h(App)
})
-
- Vue.use(VueVirtualScroller)
-
- /* eslint-disable no-new */
- return vue
}
export default afterStoreSetup
diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js
index 940b1a28..6617a937 100644
--- a/src/components/emoji_picker/emoji_picker.js
+++ b/src/components/emoji_picker/emoji_picker.js
@@ -38,11 +38,7 @@ const EmojiPicker = {
keepOpen: false,
customEmojiBufferSlice: LOAD_EMOJI_BY,
customEmojiTimeout: null,
- customEmojiLoadAllConfirmed: false,
- groupRefs: {},
- emojiRefs: {},
- filteredEmojiGroups: [],
- width: 0
+ customEmojiLoadAllConfirmed: false
}
},
components: {
@@ -60,18 +56,16 @@ const EmojiPicker = {
const value = emoji.imageUrl ? `:${emoji.displayText}:` : emoji.replacement
this.$emit('emoji', { insertion: value, keepOpen: this.keepOpen })
},
- onScroll(startIndex, endIndex, visibleStartIndex, visibleEndIndex) {
- const target = this.$refs[ 'emoji-groups' ].$el
- this.scrolledGroup(target, visibleStartIndex, visibleEndIndex)
+ onScroll (e) {
+ const target = (e && e.target) || this.$refs['emoji-groups']
+ this.updateScrolledClass(target)
+ this.scrolledGroup(target)
+ this.triggerLoadMore(target)
},
onWheel (e) {
e.preventDefault()
this.$refs['emoji-tabs'].scrollBy(e.deltaY, 0)
},
- setGroupRef(name) {
- return el => { this.groupRefs[ name ] = el }
- },
-
highlight (key) {
this.setShowStickers(false)
this.activeGroup = key
@@ -104,46 +98,17 @@ const EmojiPicker = {
this.loadEmoji()
}
},
- scrolledGroup(target, start, end) {
+ scrolledGroup (target) {
const top = target.scrollTop + 5
this.$nextTick(() => {
- this.emojiItems.slice(start, end + 1).forEach(group => {
- const headerId = toHeaderId(group.id)
- const ref = this.groupRefs[ 'group-' + group.id ]
- if (!ref) { return }
- const elem = ref.$el.parentElement
- if (!elem) { return }
- if (elem && getOffset(elem) <= top) {
- this.activeGroup = headerId
+ this.emojisView.forEach(group => {
+ const ref = this.$refs['group-' + group.id]
+ if (ref.offsetTop <= top) {
+ this.activeGroup = group.id
}
})
})
},
- onShowing() {
- const oldContentLoaded = this.contentLoaded
- this.recalculateItemPerRow()
- this.$nextTick(() => {
- this.$refs.search.focus()
- })
- this.contentLoaded = true
- this.filteredEmojiGroups = this.getFilteredEmojiGroups()
- if (!oldContentLoaded) {
- this.$nextTick(() => {
- if (this.defaultGroup) {
- this.highlight(this.defaultGroup)
- }
- })
- }
- },
- getFilteredEmojiGroups() {
- return this.allEmojiGroups
- .map(group => ({
- ...group,
- emojis: this.filterByKeyword(group.emojis, trim(this.keyword))
- }))
- .filter(group => group.emojis.length > 0)
- },
-
loadEmoji () {
const allLoaded = this.customEmojiBuffer.length === this.filteredEmoji.length
@@ -189,18 +154,6 @@ const EmojiPicker = {
}
},
computed: {
- minItemSize() {
- return this.emojiHeight
- },
- emojiHeight() {
- return 32 + 4
- },
- emojiWidth() {
- return 32 + 4
- },
- itemPerRow() {
- return this.width ? Math.floor(this.width / this.emojiWidth - 1) : 6
- },
activeGroupView () {
return this.showingStickers ? '' : this.activeGroup
},
@@ -242,17 +195,6 @@ const EmojiPicker = {
}
].concat(emojiPacks)
},
- emojiItems () {
- return this.filteredEmojiGroups.map(group =>
- chunk(group.emojis, this.itemPerRow)
- .map((items, index) => ({
- ...group,
- id: index === 0 ? group.id : `row-${index}-${group.id}`,
- emojis: items,
- isFirstRow: index === 0
- })))
- .reduce((a, c) => a.concat(c), [])
- },
sortedEmoji () {
const customEmojis = this.$store.state.instance.customEmoji || []
const sortedEmojiGroups = new Map()
diff --git a/src/components/emoji_picker/emoji_picker.vue b/src/components/emoji_picker/emoji_picker.vue
index 6a93dca6..00ffb9d2 100644
--- a/src/components/emoji_picker/emoji_picker.vue
+++ b/src/components/emoji_picker/emoji_picker.vue
@@ -8,7 +8,6 @@
>
-
-
- {{ group.text }}
-
-
- {{ emoji.replacement }}
-
-
-
-