うごいた
This commit is contained in:
parent
c56f8fd953
commit
3a7fbf9406
@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<div class="omfetrab" :class="['s' + size, 'w' + width, 'h' + height, { asDrawer }]" :style="{ maxHeight: maxHeight ? maxHeight + 'px' : undefined }">
|
||||
<input ref="search" v-model.trim="q" class="search" data-prevent-emoji-insert :class="{ filled: q != null && q != '' }" :placeholder="i18n.ts.search" type="search" @paste.stop="paste" @keyup.enter="done()">
|
||||
<MkSwitch class="_formBlock" v-model="withRenote">renote
|
||||
</MkSwitch>
|
||||
<div ref="emojis" class="emojis">
|
||||
<section class="result">
|
||||
<div v-if="searchResultCustom.length > 0" class="body">
|
||||
@ -90,6 +92,7 @@ import { deviceKind } from '@/scripts/device-kind';
|
||||
import { emojiCategories, instance } from '@/instance';
|
||||
import { i18n } from '@/i18n';
|
||||
import { defaultStore } from '@/store';
|
||||
import MkSwitch from '@/components/form/switch.vue';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
showPinned?: boolean;
|
||||
@ -101,10 +104,11 @@ const props = withDefaults(defineProps<{
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'chosen', v: string): void;
|
||||
(ev: 'chosen', v: { reaction: string, withRenote: boolean }): void;
|
||||
}>();
|
||||
|
||||
const search = ref<HTMLInputElement>();
|
||||
const withRenote = ref<boolean>(true);
|
||||
const emojis = ref<HTMLDivElement>();
|
||||
|
||||
const {
|
||||
@ -294,7 +298,7 @@ function chosen(emoji: any, ev?: MouseEvent) {
|
||||
}
|
||||
|
||||
const key = getKey(emoji);
|
||||
emit('chosen', key);
|
||||
emit('chosen', { reaction: key, withRenote: withRenote.value });
|
||||
|
||||
// 最近使った絵文字更新
|
||||
if (!pinned.value.includes(key)) {
|
||||
@ -452,6 +456,10 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
|
||||
> .renote {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
> .tabs {
|
||||
display: flex;
|
||||
display: none;
|
||||
|
@ -51,8 +51,8 @@ const emit = defineEmits<{
|
||||
const modal = ref<InstanceType<typeof MkModal>>();
|
||||
const picker = ref<InstanceType<typeof MkEmojiPicker>>();
|
||||
|
||||
function chosen(emoji: any) {
|
||||
emit('done', emoji);
|
||||
function chosen(emoji: any, withRenote: boolean) {
|
||||
emit('done', { reaction: emoji, withRenote: withRenote });
|
||||
modal.value?.close();
|
||||
}
|
||||
|
||||
|
@ -207,11 +207,18 @@ function reply(viaKeyboard = false): void {
|
||||
function react(viaKeyboard = false): void {
|
||||
pleaseLogin();
|
||||
blur();
|
||||
reactionPicker.show(reactButton.value, reaction => {
|
||||
reactionPicker.show(reactButton.value, results => {
|
||||
os.api('notes/reactions/create', {
|
||||
noteId: appearNote.id,
|
||||
reaction: reaction,
|
||||
reaction: results.reaction,
|
||||
});
|
||||
console.log(results)
|
||||
if (results.withRenote) {
|
||||
os.api('notes/create', {
|
||||
renoteId: appearNote.id,
|
||||
isRenote: true,
|
||||
});
|
||||
}
|
||||
}, () => {
|
||||
focus();
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ import { popup } from '@/os';
|
||||
class ReactionPicker {
|
||||
private src: Ref<HTMLElement | null> = ref(null);
|
||||
private manualShowing = ref(false);
|
||||
private onChosen?: (reaction: string) => void;
|
||||
private onChosen?: ({ reaction: string, withRenote: boolean }) => void;
|
||||
private onClosed?: () => void;
|
||||
|
||||
constructor() {
|
||||
@ -17,8 +17,8 @@ class ReactionPicker {
|
||||
asReactionPicker: true,
|
||||
manualShowing: this.manualShowing
|
||||
}, {
|
||||
done: reaction => {
|
||||
this.onChosen!(reaction);
|
||||
done: results => {
|
||||
this.onChosen!(results.reaction, results.withRenote);
|
||||
},
|
||||
close: () => {
|
||||
this.manualShowing.value = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user