最近使用した絵文字からリアクションピッカーに設定してある絵文字は除外するように

This commit is contained in:
syuilo 2020-11-08 13:58:16 +09:00
parent 4299e3f90c
commit c6a009dbae
2 changed files with 10 additions and 7 deletions

View file

@ -32,7 +32,7 @@
<div class="index"> <div class="index">
<section> <section>
<div> <div>
<button v-for="emoji in reactions || $store.state.settings.reactions" <button v-for="emoji in pinned"
class="_button" class="_button"
@click="chosen(emoji, $event)" @click="chosen(emoji, $event)"
tabindex="0" tabindex="0"
@ -109,7 +109,7 @@ export default defineComponent({
src: { src: {
required: false required: false
}, },
reactions: { overridePinned: {
required: false required: false
}, },
}, },
@ -120,6 +120,7 @@ export default defineComponent({
return { return {
emojilist: markRaw(emojilist), emojilist: markRaw(emojilist),
getStaticImageUrl, getStaticImageUrl,
pinned: this.overridePinned || this.$store.state.settings.reactions,
customEmojiCategories: this.$store.getters['instance/emojiCategories'], customEmojiCategories: this.$store.getters['instance/emojiCategories'],
customEmojis: this.$store.state.instance.meta.emojis, customEmojis: this.$store.state.instance.meta.emojis,
visibleCategories: {}, visibleCategories: {},
@ -334,10 +335,12 @@ export default defineComponent({
this.$refs.modal.close(); this.$refs.modal.close();
// 使 // 使
let recents = this.$store.state.device.recentlyUsedEmojis; if (!this.pinned.includes(key)) {
recents = recents.filter((e: any) => e !== key); let recents = this.$store.state.device.recentlyUsedEmojis;
recents.unshift(key); recents = recents.filter((e: any) => e !== key);
this.$store.commit('device/set', { key: 'recentlyUsedEmojis', value: recents.splice(0, 16) }); recents.unshift(key);
this.$store.commit('device/set', { key: 'recentlyUsedEmojis', value: recents.splice(0, 16) });
}
}, },
paste(event) { paste(event) {

View file

@ -82,7 +82,7 @@ export default defineComponent({
preview(ev) { preview(ev) {
if (this.$store.state.device.useFullReactionPicker) { if (this.$store.state.device.useFullReactionPicker) {
os.popup(import('@/components/emoji-picker.vue'), { os.popup(import('@/components/emoji-picker.vue'), {
reactions: this.splited, overridePinned: this.splited,
src: ev.currentTarget || ev.target, src: ev.currentTarget || ev.target,
}, {}, 'closed'); }, {}, 'closed');
} else { } else {