Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

入力フォームでもリアクション選択時に使用するピッカーを使うようにしたい #12337

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
370099d
入力フォームでもリアクション選択時に使用するピッカーを使うようにしたい
samunohito Nov 15, 2023
531313f
Merge branch 'develop' into enhance/input_form_reaction_picker
samunohito Nov 15, 2023
6b33854
erase console.log
samunohito Nov 15, 2023
52f3364
Merge branch 'develop' into enhance/input_form_reaction_picker
samunohito Nov 15, 2023
b68b4eb
fix CHANGELOG.md
samunohito Nov 15, 2023
a696a0f
Merge branch 'develop' into enhance/input_form_reaction_picker
samunohito Nov 15, 2023
d23fb31
reaction-picker.ts を戻し、今回の対応を入れた emoji-picker.ts を新たに作成
samunohito Nov 15, 2023
96ea351
Merge branch 'develop' into enhance/input_form_reaction_picker
samunohito Nov 21, 2023
a9406c3
Merge branch 'develop' into enhance/input_form_reaction_picker
samunohito Nov 22, 2023
4bf240f
fix CHANGELOG.md
samunohito Nov 22, 2023
50e0573
Merge branch 'develop' into enhance/input_form_reaction_picker
samunohito Nov 22, 2023
8e18453
Merge branch 'develop' into enhance/input_form_reaction_picker
samunohito Nov 22, 2023
bffc292
Merge branch 'develop' into enhance/input_form_reaction_picker
samunohito Nov 24, 2023
888f8b2
Merge branch 'develop' into enhance/input_form_reaction_picker
samunohito Nov 28, 2023
9c15acf
Merge branch 'develop' into enhance/input_form_reaction_picker
samunohito Dec 3, 2023
62a2922
Merge branch 'develop' into enhance/input_form_reaction_picker
syuilo Dec 3, 2023
a3b2ec4
tweak
syuilo Dec 3, 2023
77ee21d
Merge branch 'enhance/input_form_reaction_picker' of https://github.c…
syuilo Dec 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
### Client
- Enhance: プラグインでエラーが発生した場合のハンドリングを強化
- Enhance: 細かなUIのブラッシュアップ
- Enhance: 投稿フォームの絵文字ピッカーをリアクション時に使用するものと同じのを使用するように #12336
- Fix: 効果音が再生されるとデバイスで再生している動画や音声が停止する問題を修正 #12339
- Fix: デッキに表示されたチャンネルの表示先チャンネルを切り替えた際、即座に反映されない問題を修正 #12236
- Fix: プラグインでノートの表示を書き換えられない問題を修正
Expand Down
19 changes: 11 additions & 8 deletions packages/frontend/src/components/MkEmojiPickerDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,21 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>

<script lang="ts" setup>
import { shallowRef } from 'vue';
import MkModal from '@/components/MkModal.vue';
import MkEmojiPicker from '@/components/MkEmojiPicker.vue';
import { defaultStore } from '@/store.js';

withDefaults(defineProps<{
const props = withDefaults(defineProps<{
manualShowing?: boolean | null;
src?: HTMLElement;
showPinned?: boolean;
asReactionPicker?: boolean;
choseAndClose?: boolean;
}>(), {
manualShowing: null,
showPinned: true,
asReactionPicker: false,
choseAndClose: true,
});

const emit = defineEmits<{
Expand All @@ -53,21 +54,23 @@ const emit = defineEmits<{
(ev: 'closed'): void;
}>();

const modal = shallowRef<InstanceType<typeof MkModal>>();
const picker = shallowRef<InstanceType<typeof MkEmojiPicker>>();
const modal = $shallowRef<InstanceType<typeof MkModal>>();
const picker = $shallowRef<InstanceType<typeof MkEmojiPicker>>();

function chosen(emoji: any) {
emit('done', emoji);
modal.value?.close();
if (props.choseAndClose) {
modal?.close();
}
}

function opening() {
picker.value?.reset();
picker.value?.focus();
picker?.reset();
picker?.focus();

// 何故かちょっと待たないとフォーカスされない
setTimeout(() => {
picker.value?.focus();
picker?.focus();
}, 10);
}
</script>
Expand Down
12 changes: 11 additions & 1 deletion packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ import { deepClone } from '@/scripts/clone.js';
import MkRippleEffect from '@/components/MkRippleEffect.vue';
import { miLocalStorage } from '@/local-storage.js';
import { claimAchievement } from '@/scripts/achievements.js';
import { reactionPicker } from '@/scripts/reaction-picker.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

リアクションをするわけではないから別のものを作った方が良さそう

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


const modal = inject('modal');

Expand Down Expand Up @@ -845,7 +846,16 @@ function insertMention() {
}

async function insertEmoji(ev: MouseEvent) {
os.openEmojiPicker(ev.currentTarget ?? ev.target, {}, textareaEl);
reactionPicker.show(
ev.currentTarget ?? ev.target,
reaction => {
insertTextAtCursor(textareaEl, reaction);
},
() => {
focus();
},
false,
);
}

function showActions(ev) {
Expand Down
10 changes: 9 additions & 1 deletion packages/frontend/src/scripts/reaction-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { popup } from '@/os.js';
class ReactionPicker {
private src: Ref<HTMLElement | null> = ref(null);
private manualShowing = ref(false);
private choseAndClose = ref(true);
private onChosen?: (reaction: string) => void;
private onClosed?: () => void;

Expand All @@ -21,6 +22,7 @@ class ReactionPicker {
src: this.src,
asReactionPicker: true,
manualShowing: this.manualShowing,
choseAndClose: this.choseAndClose,
}, {
done: reaction => {
this.onChosen!(reaction);
Expand All @@ -35,9 +37,15 @@ class ReactionPicker {
});
}

public show(src: HTMLElement, onChosen: ReactionPicker['onChosen'], onClosed: ReactionPicker['onClosed']) {
public show(
src: HTMLElement,
onChosen: ReactionPicker['onChosen'],
onClosed: ReactionPicker['onClosed'],
choseAndClose = true,
) {
this.src.value = src;
this.manualShowing.value = true;
this.choseAndClose.value = choseAndClose;
this.onChosen = onChosen;
this.onClosed = onClosed;
}
Expand Down
Loading