fix(EmojiPicker): 投稿フォームで絵文字ボタンを押すと従来通り絵文字ピッカーのウィンドウが開くように (MisskeyIO#296)

+ お知らせの絵文字ボタンでも同じ挙動になるように
This commit is contained in:
まっちゃとーにゅ 2023-12-28 15:49:16 +09:00 committed by GitHub
parent 5b883c1a54
commit 6de9a8ccbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 12 deletions

View File

@ -13,18 +13,25 @@ SPDX-License-Identifier: AGPL-3.0-only
:front="true"
@closed="emit('closed')"
>
<MkEmojiPicker :showPinned="showPinned" :asReactionPicker="asReactionPicker" asWindow :class="$style.picker" @chosen="chosen"/>
<MkEmojiPicker
:class="$style.picker"
:showPinned="showPinned"
:pinnedEmojis="pinnedEmojis"
:asReactionPicker="asReactionPicker"
asWindow
@chosen="chosen"
/>
</MkWindow>
</template>
<script lang="ts" setup>
import { } from 'vue';
import MkWindow from '@/components/MkWindow.vue';
import MkEmojiPicker from '@/components/MkEmojiPicker.vue';
withDefaults(defineProps<{
src?: HTMLElement;
showPinned?: boolean;
pinnedEmojis?: string[],
asReactionPicker?: boolean;
}>(), {
showPinned: true,

View File

@ -860,15 +860,10 @@ function insertMention() {
async function insertEmoji(ev: MouseEvent) {
textAreaReadOnly.value = true;
emojiPicker.show(
ev.currentTarget ?? ev.target,
emoji => {
insertTextAtCursor(textareaEl.value, emoji);
},
() => {
textAreaReadOnly.value = false;
nextTick(() => focus());
},
os.openEmojiPicker(
(ev.currentTarget ?? ev.target) as HTMLElement,
{ asReactionPicker: false },
textareaEl.value
);
}

View File

@ -12,6 +12,7 @@ import { EventEmitter } from 'eventemitter3';
import insertTextAtCursor from 'insert-text-at-cursor';
import * as Misskey from 'misskey-js';
import { i18n } from '@/i18n.js';
import { defaultStore } from '@/store.js';
import MkPostFormDialog from '@/components/MkPostFormDialog.vue';
import MkWaitingDialog from '@/components/MkWaitingDialog.vue';
import MkPageWindow from '@/components/MkPageWindow.vue';
@ -533,6 +534,7 @@ export async function openEmojiPicker(src?: HTMLElement, opts, initialTextarea:
openingEmojiPicker = await popup(MkEmojiPickerWindow, {
src,
pinnedEmojis: opts?.asReactionPicker ? defaultStore.reactiveState.reactions : defaultStore.reactiveState.pinnedEmojis,
...opts,
}, {
chosen: emoji => {

View File

@ -131,7 +131,11 @@ function editUser(announcement): void {
}
function insertEmoji(ev: MouseEvent): void {
os.openEmojiPicker((ev.currentTarget ?? ev.target) as HTMLElement, {}, announceTitleEl.value);
os.openEmojiPicker(
(ev.currentTarget ?? ev.target) as HTMLElement,
{ asReactionPicker: false },
announceTitleEl.value
);
}
function add() {