Sort emojis alphabetically
This commit is contained in:
parent
0c1c549631
commit
a08df92ccc
3 changed files with 11 additions and 6 deletions
|
@ -42,9 +42,9 @@
|
|||
<el-collapse-item v-if="isLocal" :title=" $t('emoji.addNewEmoji')" name="addEmoji" class="no-background">
|
||||
<new-emoji-uploader :pack-name="name"/>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item v-if="Object.keys(pack.files).length > 0" :title=" $t('emoji.manageEmoji')" name="manageEmoji" class="no-background">
|
||||
<el-collapse-item v-if="pack.files.length > 0" :title=" $t('emoji.manageEmoji')" name="manageEmoji" class="no-background">
|
||||
<single-emoji-editor
|
||||
v-for="(file, shortcode) in pack.files"
|
||||
v-for="[shortcode, file] in pack.files"
|
||||
:key="shortcode"
|
||||
:host="host"
|
||||
:pack-name="name"
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
</el-form-item>
|
||||
</el-form>
|
||||
<el-collapse v-model="showPackContent" class="contents-collapse">
|
||||
<el-collapse-item v-if="Object.keys(pack.files).length > 0" :title=" $t('emoji.manageEmoji')" name="manageEmoji" class="no-background">
|
||||
<el-collapse-item v-if="pack.files.length > 0" :title=" $t('emoji.manageEmoji')" name="manageEmoji" class="no-background">
|
||||
<single-emoji-editor
|
||||
v-for="(file, shortcode) in pack.files"
|
||||
v-for="[shortcode, file] in pack.files"
|
||||
:key="shortcode"
|
||||
:host="host"
|
||||
:pack-name="name"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item v-if="Object.keys(localPacks).length > 0" :label="$t('emoji.packs')">
|
||||
<el-collapse v-for="(pack, name) in localPacks" :key="name" v-model="activeLocalPack">
|
||||
<local-emoji-pack :name="name" :pack="pack" :host="$store.getters.authHost" :is-local="true" />
|
||||
<local-emoji-pack :name="name" :pack="sortPack(pack)" :host="$store.getters.authHost" :is-local="true" />
|
||||
</el-collapse>
|
||||
</el-form-item>
|
||||
<el-divider class="divider"/>
|
||||
|
@ -52,7 +52,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item v-if="Object.keys(remotePacks).length > 0" :label="$t('emoji.packs')">
|
||||
<el-collapse v-for="(pack, name) in remotePacks" :key="name" v-model="activeRemotePack" @change="setActiveCollapseItems">
|
||||
<remote-emoji-pack :name="name" :pack="pack" :host="$store.getters.authHost" :is-local="false" />
|
||||
<remote-emoji-pack :name="name" :pack="sortPack(pack)" :host="$store.getters.authHost" :is-local="false" />
|
||||
</el-collapse>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -128,6 +128,11 @@ export default {
|
|||
this.$store.dispatch('ReloadEmoji')
|
||||
})
|
||||
},
|
||||
sortPack(pack) {
|
||||
const orderedFiles = Object.keys(pack.files).sort((a, b) => a.localeCompare(b))
|
||||
.map(key => [key, pack.files[key]])
|
||||
return { ...pack, files: orderedFiles }
|
||||
},
|
||||
refreshLocalPacks() {
|
||||
try {
|
||||
this.$store.dispatch('SetLocalEmojiPacks')
|
||||
|
|
Loading…
Reference in a new issue