From 866abff54d8e3c377361a0d75ef7ee59ba2fcd84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:45:53 +0900 Subject: [PATCH] =?UTF-8?q?enhance(frontend):=20=E3=83=96=E3=83=A9?= =?UTF-8?q?=E3=82=A6=E3=82=B6=E3=81=AE=E3=82=B3=E3=83=B3=E3=83=86=E3=82=AD?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E3=82=92?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=20(#14076)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * enhance(frontend): ブラウザのコンテキストメニューを使用できるように * Update Changelog * shiftにした * change keys * fix * fix * fix * update translation keys --------- Co-authored-by: tamaina --- CHANGELOG.md | 1 + locales/index.d.ts | 18 ++++++++++++++++++ locales/ja-JP.yml | 6 ++++++ packages/frontend/src/os.ts | 8 ++++++++ .../frontend/src/pages/settings/general.vue | 8 ++++++++ packages/frontend/src/store.ts | 4 ++++ 6 files changed, 45 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0be36a2cb3..17cf4d3275 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - Enhance: ドライブのファイル・フォルダをドラッグしなくても移動できるように (Cherry-picked from https://github.com/nafu-at/misskey/commit/b89c2af6945c6a9f9f10e83f54d2bcf0f240b0b4, https://github.com/nafu-at/misskey/commit/8a7d710c6acb83f50c83f050bd1423c764d60a99) - Enhance: デッキのアンテナ・リスト選択画面からそれぞれを新規作成できるように +- Enhance: ブラウザのコンテキストメニューを使用できるように - Fix: `/about#federation` ページなどで各インスタンスのチャートが表示されなくなっていた問題を修正 - Fix: ユーザーページの追加情報のラベルを投稿者のサーバーの絵文字で表示する (#13968) - Fix: リバーシの対局を正しく共有できないことがある問題を修正 diff --git a/locales/index.d.ts b/locales/index.d.ts index 848050583b..30c21c92e7 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -10118,6 +10118,24 @@ export interface Locale extends ILocale { */ "loop": string; }; + "_contextMenu": { + /** + * コンテキストメニュー + */ + "title": string; + /** + * アプリケーション + */ + "app": string; + /** + * Shiftキーでアプリケーション + */ + "appWithShift": string; + /** + * ブラウザのUI + */ + "native": string; + }; } declare const locales: { [lang: string]: Locale; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 22228f9254..ea2ffb9c0d 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2697,3 +2697,9 @@ _mediaControls: pip: "ピクチャインピクチャ" playbackRate: "再生速度" loop: "ループ再生" + +_contextMenu: + title: "コンテキストメニュー" + app: "アプリケーション" + appWithShift: "Shiftキーでアプリケーション" + native: "ブラウザのUI" diff --git a/packages/frontend/src/os.ts b/packages/frontend/src/os.ts index a8dd99c854..f42e2ed3c5 100644 --- a/packages/frontend/src/os.ts +++ b/packages/frontend/src/os.ts @@ -11,6 +11,7 @@ import * as Misskey from 'misskey-js'; import type { ComponentProps as CP } from 'vue-component-type-helpers'; import type { Form, GetFormResultType } from '@/scripts/form.js'; import { misskeyApi } from '@/scripts/misskey-api.js'; +import { defaultStore } from '@/store.js'; import { i18n } from '@/i18n.js'; import MkPostFormDialog from '@/components/MkPostFormDialog.vue'; import MkWaitingDialog from '@/components/MkWaitingDialog.vue'; @@ -654,6 +655,13 @@ export function popupMenu(items: MenuItem[], src?: HTMLElement | EventTarget | n } export function contextMenu(items: MenuItem[], ev: MouseEvent): Promise { + if ( + defaultStore.state.contextMenu === 'native' || + (defaultStore.state.contextMenu === 'appWithShift' && !ev.shiftKey) + ) { + return Promise.resolve(); + } + let returnFocusTo = getHTMLElementOrNull(ev.currentTarget ?? ev.target) ?? getHTMLElementOrNull(document.activeElement); ev.preventDefault(); return new Promise(resolve => nextTick(() => { diff --git a/packages/frontend/src/pages/settings/general.vue b/packages/frontend/src/pages/settings/general.vue index 9e429f8dbd..94ef3b8485 100644 --- a/packages/frontend/src/pages/settings/general.vue +++ b/packages/frontend/src/pages/settings/general.vue @@ -177,6 +177,12 @@ SPDX-License-Identifier: AGPL-3.0-only + + + + + + @@ -317,6 +323,7 @@ const enableHorizontalSwipe = computed(defaultStore.makeGetterSetter('enableHori const useNativeUIForVideoAudioPlayer = computed(defaultStore.makeGetterSetter('useNativeUIForVideoAudioPlayer')); const alwaysConfirmFollow = computed(defaultStore.makeGetterSetter('alwaysConfirmFollow')); const confirmWhenRevealingSensitiveMedia = computed(defaultStore.makeGetterSetter('confirmWhenRevealingSensitiveMedia')); +const contextMenu = computed(defaultStore.makeGetterSetter('contextMenu')); watch(lang, () => { miLocalStorage.setItem('lang', lang.value as string); @@ -360,6 +367,7 @@ watch([ enableSeasonalScreenEffect, alwaysConfirmFollow, confirmWhenRevealingSensitiveMedia, + contextMenu, ], async () => { await reloadAsk(); }); diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index dbf6b8716f..437314074a 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -458,6 +458,10 @@ export const defaultStore = markRaw(new Storage('base', { where: 'device', default: false, }, + contextMenu: { + where: 'device', + default: 'app' as 'app' | 'appWithShift' | 'native', + }, sound_masterVolume: { where: 'device',