From 03e21d61b9cdc7b1e4f75f21ca5214602eba4af3 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 | 34 +++++++------------ 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f2c36ffc3..a4c79f93ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - ### Client +- Enhance: リモートのノートのリンクをコピーできるように - Fix: 画面サイズが変わった際にナビゲーションバーが自動で折りたたまれない問題を修正 - Fix: サーバー情報メニューに区切り線が不足していたのを修正 diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts index a439403281..d998ffc591 100644 --- a/packages/frontend/src/scripts/get-note-menu.ts +++ b/packages/frontend/src/scripts/get-note-menu.ts @@ -237,17 +237,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, @@ -313,7 +302,7 @@ export function getNoteMenu(props: { text: i18n.ts.unclip, danger: true, action: unclip, - }, { type: 'divider' }); + }, { type: 'divider' as const }); } menuItems.push({ @@ -327,16 +316,19 @@ export function getNoteMenu(props: { }, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink)); if (appearNote.url || appearNote.uri) { - menuItems.push({ + menuItems.push({ // リモートのリンクをコピー + icon: 'ti ti-external-link', + text: i18n.ts.showOnRemote, + 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'); }, - }, { // リモートのリンクをコピー - icon: 'ti ti-external-link', - text: i18n.ts.showOnRemote, - action: () => copyNoteLinkOnRemoteServer, }); } else { menuItems.push(getNoteEmbedCodeMenu(appearNote, i18n.ts.genEmbedCode)); @@ -358,7 +350,7 @@ export function getNoteMenu(props: { }); } - menuItems.push({ type: 'divider' }); + menuItems.push({ type: 'divider' as const }); menuItems.push(statePromise.then(state => state.isFavorited ? { icon: 'ti ti-star-off', @@ -416,12 +408,12 @@ export function getNoteMenu(props: { }); if (appearNote.userId !== $i.id) { - menuItems.push({ type: 'divider' }); + menuItems.push({ type: 'divider' as const }); menuItems.push(getAbuseNoteMenu(appearNote, i18n.ts.reportAbuse)); } if (appearNote.channel && (appearNote.channel.userId === $i.id || $i.isModerator || $i.isAdmin)) { - menuItems.push({ type: 'divider' }); + menuItems.push({ type: 'divider' as const }); menuItems.push({ type: 'parent', icon: 'ti ti-device-tv', @@ -456,7 +448,7 @@ export function getNoteMenu(props: { } if (appearNote.userId === $i.id || $i.isModerator || $i.isAdmin) { - menuItems.push({ type: 'divider' }); + menuItems.push({ type: 'divider' as const }); if (appearNote.userId === $i.id) { menuItems.push({ icon: 'ti ti-edit',