mirror of
https://codeberg.org/yeentown/barkey
synced 2024-12-04 02:47:27 +00:00
29350c9f33
* refactor(frontend): `os.ts`周りのリファクタリング * refactor: apiWithDialogのdataの型付け * refactor: 不要なas anyを除去 * refactor: 返り値の型を明記、`selectDriveFolder`は`File`のほうに合わせるよう返り値を変更 * refactor: 返り値の型を改善 * refactor: フォームの型を改善 * refactor: 良い感じのimportに修正 * refactor: フォームの返り値の型を改善 * refactor: `popup()`の`props`に`ref`な値を入れるのを許可するように * fix: `os.input`系と`os.select`の返り値の型がおかしい問題とそれによるバグを修正 * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
91 lines
2 KiB
Vue
91 lines
2 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<MkModal
|
|
ref="modal"
|
|
v-slot="{ type, maxHeight }"
|
|
:zPriority="'middle'"
|
|
:preferType="defaultStore.state.emojiPickerUseDrawerForMobile === false ? 'popup' : 'auto'"
|
|
:transparentBg="true"
|
|
:manualShowing="manualShowing"
|
|
:src="src"
|
|
@click="modal?.close()"
|
|
@opening="opening"
|
|
@close="emit('close')"
|
|
@closed="emit('closed')"
|
|
>
|
|
<MkEmojiPicker
|
|
ref="picker"
|
|
class="_popup _shadow"
|
|
:class="{ [$style.drawer]: type === 'drawer' }"
|
|
:showPinned="showPinned"
|
|
:pinnedEmojis="pinnedEmojis"
|
|
:asReactionPicker="asReactionPicker"
|
|
:targetNote="targetNote"
|
|
:asDrawer="type === 'drawer'"
|
|
:max-height="maxHeight"
|
|
@chosen="chosen"
|
|
/>
|
|
</MkModal>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import * as Misskey from 'misskey-js';
|
|
import { shallowRef } from 'vue';
|
|
import MkModal from '@/components/MkModal.vue';
|
|
import MkEmojiPicker from '@/components/MkEmojiPicker.vue';
|
|
import { defaultStore } from '@/store.js';
|
|
|
|
const props = withDefaults(defineProps<{
|
|
manualShowing?: boolean | null;
|
|
src?: HTMLElement;
|
|
showPinned?: boolean;
|
|
pinnedEmojis?: string[],
|
|
asReactionPicker?: boolean;
|
|
targetNote?: Misskey.entities.Note;
|
|
choseAndClose?: boolean;
|
|
}>(), {
|
|
manualShowing: null,
|
|
showPinned: true,
|
|
pinnedEmojis: undefined,
|
|
asReactionPicker: false,
|
|
choseAndClose: true,
|
|
});
|
|
|
|
const emit = defineEmits<{
|
|
(ev: 'done', v: string): void;
|
|
(ev: 'close'): void;
|
|
(ev: 'closed'): void;
|
|
}>();
|
|
|
|
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
|
const picker = shallowRef<InstanceType<typeof MkEmojiPicker>>();
|
|
|
|
function chosen(emoji: string) {
|
|
emit('done', emoji);
|
|
if (props.choseAndClose) {
|
|
modal.value?.close();
|
|
}
|
|
}
|
|
|
|
function opening() {
|
|
picker.value?.reset();
|
|
picker.value?.focus();
|
|
|
|
// 何故かちょっと待たないとフォーカスされない
|
|
setTimeout(() => {
|
|
picker.value?.focus();
|
|
}, 10);
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.drawer {
|
|
border-radius: 24px;
|
|
border-bottom-right-radius: 0;
|
|
border-bottom-left-radius: 0;
|
|
}
|
|
</style>
|