Merge pull request #1970 from h3poteto/fix/emoji-picker

fix: Don't always render emoji picker and tool menu
This commit is contained in:
AkiraFukushima 2020-12-02 21:42:35 +09:00 committed by GitHub
commit fb57e75fb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 4 deletions

View File

@ -179,8 +179,18 @@
<icon name="quote-right" scale="0.9"></icon> <icon name="quote-right" scale="0.9"></icon>
</el-button> </el-button>
<template v-if="sns !== 'mastodon'"> <template v-if="sns !== 'mastodon'">
<el-popover placement="bottom" width="281" trigger="click" popper-class="status-emoji-picker" ref="status_emoji_picker"> <el-popover
placement="bottom"
width="281"
trigger="click"
popper-class="status-emoji-picker"
ref="status_emoji_picker"
@show="openPicker"
@hide="hidePicker"
>
<!-- TODO: これすべてのコンポーネントでレンダリングすると負荷が高すぎる v-ifしたい -->
<picker <picker
v-if="openEmojiPicker"
set="emojione" set="emojione"
:autoFocus="true" :autoFocus="true"
@select="selectEmoji" @select="selectEmoji"
@ -198,8 +208,16 @@
<el-button class="pinned" type="text" :title="$t('cards.toot.pinned')" :aria-label="$t('cards.toot.pinned')" v-show="pinned"> <el-button class="pinned" type="text" :title="$t('cards.toot.pinned')" :aria-label="$t('cards.toot.pinned')" v-show="pinned">
<icon name="thumbtack" scale="0.9"></icon> <icon name="thumbtack" scale="0.9"></icon>
</el-button> </el-button>
<el-popover placement="bottom" width="200" trigger="click" popper-class="status-menu-popper" ref="status_menu_popper"> <el-popover
<ul class="menu-list"> placement="bottom"
width="200"
trigger="click"
popper-class="status-menu-popper"
ref="status_menu_popper"
@show="openMenu"
@hide="hideMenu"
>
<ul class="menu-list" v-if="openToolMenu">
<li role="button" @click="openDetail(message)" v-show="!detailed"> <li role="button" @click="openDetail(message)" v-show="!detailed">
{{ $t('cards.toot.view_toot_detail') }} {{ $t('cards.toot.view_toot_detail') }}
</li> </li>
@ -271,7 +289,8 @@ export default {
showAttachments: this.$store.state.App.ignoreNFSW, showAttachments: this.$store.state.App.ignoreNFSW,
hideAllAttachments: this.$store.state.App.hideAllAttachments, hideAllAttachments: this.$store.state.App.hideAllAttachments,
now: Date.now(), now: Date.now(),
openEmojiPicker: false openEmojiPicker: false,
openToolMenu: false
} }
}, },
props: { props: {
@ -711,6 +730,18 @@ export default {
}, },
openQuote() { openQuote() {
this.$store.dispatch('TimelineSpace/Modals/NewToot/openQuote', this.originalMessage) this.$store.dispatch('TimelineSpace/Modals/NewToot/openQuote', this.originalMessage)
},
openPicker() {
this.openEmojiPicker = true
},
hidePicker() {
this.openEmojiPicker = false
},
openMenu() {
this.openToolMenu = true
},
hideMenu() {
this.openToolMenu = false
} }
} }
} }