From 527b812cce77048ee56cc93ac339b33be26e4348 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Fri, 3 May 2024 15:00:50 +0900 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E3=81=97=E5=88=86=E3=81=91=E3=81=AE?= =?UTF-8?q?=E3=83=AD=E3=82=B8=E3=83=83=E3=82=AF=E3=82=921=E7=AE=87?= =?UTF-8?q?=E6=89=80=E3=81=AB=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../frontend/src/scripts/get-note-menu.ts | 41 ++++++++----------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f3ae412ef..1ba084fbbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ - Enhance: フォローするかどうかの確認ダイアログを出せるように - Enhance: Playを手動でリロードできるように - Enhance: 通報のコメント内のリンクをクリックした際、ウィンドウで開くように +- Enhance: リモートのノートのリンクをコピーできるように - Chore: AiScriptを0.18.0にバージョンアップ - Fix: 一部のページ内リンクが正しく動作しない問題を修正 - Fix: 周年の実績が閏年を考慮しない問題を修正 diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts index 5ac5645af0..3716620b02 100644 --- a/packages/frontend/src/scripts/get-note-menu.ts +++ b/packages/frontend/src/scripts/get-note-menu.ts @@ -227,17 +227,6 @@ export function getNoteMenu(props: { os.success(); } - async function copyNoteLinkOnRemoteServer(): Promise { - // TODO: 何が違う? - copyToClipboard(appearNote.url ?? appearNote.uri); - return os.success(); - } - - function copyLink(): void { - copyToClipboard(`${url}/notes/${appearNote.id}`); - os.success(); - } - function togglePin(pin: boolean): void { os.apiWithDialog(pin ? 'i/pin' : 'i/unpin', { noteId: appearNote.id, @@ -305,7 +294,7 @@ export function getNoteMenu(props: { text: i18n.ts.unclip, danger: true, action: unclip, - }, { type: 'divider' }] : [] + }, { type: 'divider' as const }] : [] ), { icon: 'ti ti-info-circle', text: i18n.ts.details, @@ -314,20 +303,22 @@ export function getNoteMenu(props: { icon: 'ti ti-copy', text: i18n.ts.copyContent, action: copyContent, - }, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink) - , (appearNote.url || appearNote.uri) ? { + }, + getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink), + ...((appearNote.url != null || appearNote.uri != null) ? [{ + icon: 'ti ti-link', + text: `${i18n.ts.copyLink} (${i18n.ts.remote})`, + action: () => { + copyToClipboard(appearNote.url ?? appearNote.uri); + os.success(); + }, + }, { icon: 'ti ti-external-link', text: i18n.ts.showOnRemote, action: () => { window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener'); }, - } : undefined, - // リモートのリンクをコピー - (appearNote.url || appearNote.uri) ? { - icon: 'ti ti-external-link', - text: i18n.ts.showOnRemote, - action: () => copyNoteLinkOnRemoteServer, - } : undefined, + }] : []), ...(isSupportShare() ? [{ icon: 'ti ti-share', text: i18n.ts.share, @@ -338,7 +329,7 @@ export function getNoteMenu(props: { text: i18n.ts.translate, action: translate, } : undefined, - { type: 'divider' }, + { type: 'divider' as const }, statePromise.then(state => state.isFavorited ? { icon: 'ti ti-star-off', text: i18n.ts.unfavorite, @@ -394,13 +385,13 @@ export function getNoteMenu(props: { : [] ),*/ ...(appearNote.userId !== $i.id ? [ - { type: 'divider' }, + { type: 'divider' as const }, appearNote.userId !== $i.id ? getAbuseNoteMenu(appearNote, i18n.ts.reportAbuse) : undefined, ] : [] ), ...(appearNote.channel && (appearNote.channel.userId === $i.id || $i.isModerator || $i.isAdmin) ? [ - { type: 'divider' }, + { type: 'divider' as const }, { type: 'parent' as const, icon: 'ti ti-device-tv', @@ -436,7 +427,7 @@ export function getNoteMenu(props: { : [] ), ...(appearNote.userId === $i.id || $i.isModerator || $i.isAdmin ? [ - { type: 'divider' }, + { type: 'divider' as const }, appearNote.userId === $i.id ? { icon: 'ti ti-edit', text: i18n.ts.deleteAndEdit,