From 8668bc2609e82f64984b8a347a207668e3e4765b Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 20 Feb 2021 16:16:19 +0900 Subject: [PATCH] =?UTF-8?q?=E5=8F=B3=E3=82=AF=E3=83=AA=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=81=A7=E3=83=AA=E3=82=A2=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E3=83=94=E3=83=83=E3=82=AB=E3=83=BC=E3=82=92=E9=96=8B=E3=81=8F?= =?UTF-8?q?=E3=82=AA=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 1 + src/client/components/note-detailed.vue | 8 +++++++- src/client/components/note.vue | 8 +++++++- src/client/components/ui/modal.vue | 1 + src/client/pages/settings/general.vue | 2 ++ src/client/store.ts | 4 ++++ src/client/ui/chat/note.vue | 8 +++++++- 7 files changed, 29 insertions(+), 3 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 51a82a32b9..a927d108bb 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -705,6 +705,7 @@ apply: "適用" receiveAnnouncementFromInstance: "インスタンスからのお知らせを受け取る" emailNotification: "メール通知" inChannelSearch: "チャンネル内検索" +useReactionPickerForContextMenu: "右クリックでリアクションピッカーを開く" _email: _follow: diff --git a/src/client/components/note-detailed.vue b/src/client/components/note-detailed.vue index 1108bd2c27..434dd56ba3 100644 --- a/src/client/components/note-detailed.vue +++ b/src/client/components/note-detailed.vue @@ -756,7 +756,13 @@ export default defineComponent({ }; if (isLink(e.target)) return; if (window.getSelection().toString() !== '') return; - os.contextMenu(this.getMenu(), e).then(this.focus); + + if (this.$store.state.useReactionPickerForContextMenu) { + e.preventDefault(); + this.react(); + } else { + os.contextMenu(this.getMenu(), e).then(this.focus); + } }, menu(viaKeyboard = false) { diff --git a/src/client/components/note.vue b/src/client/components/note.vue index d532289857..24c374869d 100644 --- a/src/client/components/note.vue +++ b/src/client/components/note.vue @@ -731,7 +731,13 @@ export default defineComponent({ }; if (isLink(e.target)) return; if (window.getSelection().toString() !== '') return; - os.contextMenu(this.getMenu(), e).then(this.focus); + + if (this.$store.state.useReactionPickerForContextMenu) { + e.preventDefault(); + this.react(); + } else { + os.contextMenu(this.getMenu(), e).then(this.focus); + } }, menu(viaKeyboard = false) { diff --git a/src/client/components/ui/modal.vue b/src/client/components/ui/modal.vue index 69a83e002c..405fa4aaa5 100644 --- a/src/client/components/ui/modal.vue +++ b/src/client/components/ui/modal.vue @@ -70,6 +70,7 @@ export default defineComponent({ // TODO: ResizeObserver無くしたい new ResizeObserver((entries, observer) => { const rect = this.src.getBoundingClientRect(); + const width = popover.offsetWidth; const height = popover.offsetHeight; diff --git a/src/client/pages/settings/general.vue b/src/client/pages/settings/general.vue index 0e741d474c..90ff3e2c20 100644 --- a/src/client/pages/settings/general.vue +++ b/src/client/pages/settings/general.vue @@ -19,6 +19,7 @@ {{ $ts.openImageInNewTab }} {{ $ts.enableInfiniteScroll }} + {{ $ts.useReactionPickerForContextMenu }} {{ $ts.disablePagesScript }} @@ -144,6 +145,7 @@ export default defineComponent({ chatOpenBehavior: ColdDeviceStorage.makeGetterSetter('chatOpenBehavior'), instanceTicker: defaultStore.makeGetterSetter('instanceTicker'), enableInfiniteScroll: defaultStore.makeGetterSetter('enableInfiniteScroll'), + useReactionPickerForContextMenu: defaultStore.makeGetterSetter('useReactionPickerForContextMenu'), }, watch: { diff --git a/src/client/store.ts b/src/client/store.ts index bf042d8ab4..528e563fdd 100644 --- a/src/client/store.ts +++ b/src/client/store.ts @@ -144,6 +144,10 @@ export const defaultStore = markRaw(new Storage('base', { where: 'device', default: true }, + useReactionPickerForContextMenu: { + where: 'device', + default: true + }, showGapBetweenNotesInTimeline: { where: 'device', default: true diff --git a/src/client/ui/chat/note.vue b/src/client/ui/chat/note.vue index f4c9f063dc..4e4a303c36 100644 --- a/src/client/ui/chat/note.vue +++ b/src/client/ui/chat/note.vue @@ -741,7 +741,13 @@ export default defineComponent({ }; if (isLink(e.target)) return; if (window.getSelection().toString() !== '') return; - os.contextMenu(this.getMenu(), e).then(this.focus); + + if (this.$store.state.useReactionPickerForContextMenu) { + e.preventDefault(); + this.react(); + } else { + os.contextMenu(this.getMenu(), e).then(this.focus); + } }, menu(viaKeyboard = false) {