2021-02-27 06:08:34 +02:00
|
|
|
<template>
|
2022-01-18 16:06:16 +02:00
|
|
|
<MkModal
|
|
|
|
ref="modal"
|
|
|
|
v-slot="{ type, maxHeight }"
|
2023-05-19 07:58:09 +03:00
|
|
|
:zPriority="'middle'"
|
|
|
|
:preferType="asReactionPicker && defaultStore.state.reactionPickerUseDrawerForMobile === false ? 'popup' : 'auto'"
|
|
|
|
:transparentBg="true"
|
|
|
|
:manualShowing="manualShowing"
|
2022-01-18 16:06:16 +02:00
|
|
|
:src="src"
|
|
|
|
@click="modal?.close()"
|
|
|
|
@opening="opening"
|
|
|
|
@close="emit('close')"
|
|
|
|
@closed="emit('closed')"
|
|
|
|
>
|
|
|
|
<MkEmojiPicker
|
|
|
|
ref="picker"
|
2023-05-27 05:35:26 +03:00
|
|
|
class="_popup _shadow"
|
|
|
|
:class="{ [$style.drawer]: type === 'drawer' }"
|
2023-05-19 07:58:09 +03:00
|
|
|
:showPinned="showPinned"
|
|
|
|
:asReactionPicker="asReactionPicker"
|
|
|
|
:asDrawer="type === 'drawer'"
|
2022-01-18 16:06:16 +02:00
|
|
|
:max-height="maxHeight"
|
|
|
|
@chosen="chosen"
|
|
|
|
/>
|
2021-12-16 19:14:40 +02:00
|
|
|
</MkModal>
|
2021-02-27 06:08:34 +02:00
|
|
|
</template>
|
|
|
|
|
2022-01-18 16:06:16 +02:00
|
|
|
<script lang="ts" setup>
|
2023-01-03 06:37:32 +02:00
|
|
|
import { shallowRef } from 'vue';
|
2022-09-06 12:21:49 +03:00
|
|
|
import MkModal from '@/components/MkModal.vue';
|
2022-08-30 18:24:33 +03:00
|
|
|
import MkEmojiPicker from '@/components/MkEmojiPicker.vue';
|
2022-01-18 16:06:16 +02:00
|
|
|
import { defaultStore } from '@/store';
|
2021-02-27 06:08:34 +02:00
|
|
|
|
2022-01-18 16:06:16 +02:00
|
|
|
withDefaults(defineProps<{
|
2022-01-28 05:30:47 +02:00
|
|
|
manualShowing?: boolean | null;
|
2022-01-18 16:06:16 +02:00
|
|
|
src?: HTMLElement;
|
|
|
|
showPinned?: boolean;
|
|
|
|
asReactionPicker?: boolean;
|
|
|
|
}>(), {
|
2022-01-28 05:30:47 +02:00
|
|
|
manualShowing: null,
|
2022-01-18 16:06:16 +02:00
|
|
|
showPinned: true,
|
|
|
|
asReactionPicker: false,
|
|
|
|
});
|
2021-02-27 06:08:34 +02:00
|
|
|
|
2022-01-18 16:06:16 +02:00
|
|
|
const emit = defineEmits<{
|
2022-01-28 05:20:42 +02:00
|
|
|
(ev: 'done', v: any): void;
|
|
|
|
(ev: 'close'): void;
|
|
|
|
(ev: 'closed'): void;
|
2022-01-18 16:06:16 +02:00
|
|
|
}>();
|
2021-02-27 06:08:34 +02:00
|
|
|
|
2023-01-03 06:37:32 +02:00
|
|
|
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
|
|
|
const picker = shallowRef<InstanceType<typeof MkEmojiPicker>>();
|
2021-02-27 06:08:34 +02:00
|
|
|
|
2022-01-18 16:06:16 +02:00
|
|
|
function chosen(emoji: any) {
|
|
|
|
emit('done', emoji);
|
|
|
|
modal.value?.close();
|
|
|
|
}
|
2021-02-28 03:03:52 +02:00
|
|
|
|
2022-01-18 16:06:16 +02:00
|
|
|
function opening() {
|
|
|
|
picker.value?.reset();
|
|
|
|
picker.value?.focus();
|
2023-01-09 10:08:58 +02:00
|
|
|
|
|
|
|
// 何故かちょっと待たないとフォーカスされない
|
|
|
|
setTimeout(() => {
|
|
|
|
picker.value?.focus();
|
|
|
|
}, 10);
|
2022-01-18 16:06:16 +02:00
|
|
|
}
|
2021-02-27 06:08:34 +02:00
|
|
|
</script>
|
|
|
|
|
2023-05-27 05:35:26 +03:00
|
|
|
<style lang="scss" module>
|
|
|
|
.drawer {
|
|
|
|
border-radius: 24px;
|
|
|
|
border-bottom-right-radius: 0;
|
|
|
|
border-bottom-left-radius: 0;
|
2021-02-27 06:08:34 +02:00
|
|
|
}
|
|
|
|
</style>
|