1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-05 10:18:42 +09:00

不足分の埋め込みメニューを追加

This commit is contained in:
kakkokari-gtyih 2024-06-26 00:32:26 +09:00
parent b507b6240c
commit 9b778a88c6
6 changed files with 62 additions and 31 deletions

2
locales/index.d.ts vendored
View File

@ -4993,7 +4993,7 @@ export interface Locale extends ILocale {
*/ */
"copyEmbedCode": string; "copyEmbedCode": string;
/** /**
* *
*/ */
"noteOfThisUser": string; "noteOfThisUser": string;
"_delivery": { "_delivery": {

View File

@ -1244,7 +1244,7 @@ alwaysConfirmFollow: "フォローの際常に確認する"
inquiry: "お問い合わせ" inquiry: "お問い合わせ"
fromX: "{x}から" fromX: "{x}から"
copyEmbedCode: "埋め込みコードをコピー" copyEmbedCode: "埋め込みコードをコピー"
noteOfThisUser: "このユーザーのノート" noteOfThisUser: "このユーザーのノート一覧"
_delivery: _delivery:
status: "配信状態" status: "配信状態"

View File

@ -44,6 +44,7 @@ import MkButton from '@/components/MkButton.vue';
import { clipsCache } from '@/cache.js'; import { clipsCache } from '@/cache.js';
import { isSupportShare } from '@/scripts/navigator.js'; import { isSupportShare } from '@/scripts/navigator.js';
import copyToClipboard from '@/scripts/copy-to-clipboard.js'; import copyToClipboard from '@/scripts/copy-to-clipboard.js';
import { copyEmbedCode } from '@/scripts/get-embed-code.js';
const props = defineProps<{ const props = defineProps<{
clipId: string, clipId: string,
@ -127,21 +128,33 @@ const headerActions = computed(() => clip.value && isOwned.value ? [{
clipsCache.delete(); clipsCache.delete();
}, },
}, ...(clip.value.isPublic ? [{ }, ...(clip.value.isPublic ? [{
icon: 'ti ti-link',
text: i18n.ts.copyUrl,
handler: async (): Promise<void> => {
copyToClipboard(`${url}/clips/${clip.value.id}`);
os.success();
},
}] : []), ...(clip.value.isPublic && isSupportShare() ? [{
icon: 'ti ti-share', icon: 'ti ti-share',
text: i18n.ts.share, text: i18n.ts.share,
handler: async (): Promise<void> => { handler: (ev: MouseEvent): void => {
navigator.share({ os.popupMenu([{
title: clip.value.name, icon: 'ti ti-link',
text: clip.value.description, text: i18n.ts.copyUrl,
url: `${url}/clips/${clip.value.id}`, action: () => {
}); copyToClipboard(`${url}/clips/${clip.value!.id}`);
os.success();
},
}, {
icon: 'ti ti-code',
text: i18n.ts.copyEmbedCode,
action: () => {
copyEmbedCode('clips', clip.value!.id);
},
}, ...(isSupportShare() ? [{
icon: 'ti ti-share',
text: i18n.ts.share,
action: async () => {
navigator.share({
title: clip.value!.name,
text: clip.value!.description ?? '',
url: `${url}/clips/${clip.value!.id}`,
});
},
}] : [])], ev.currentTarget ?? ev.target);
}, },
}] : []), { }] : []), {
icon: 'ti ti-trash', icon: 'ti ti-trash',

View File

@ -28,6 +28,7 @@ import { i18n } from '@/i18n.js';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { defaultStore } from '@/store.js'; import { defaultStore } from '@/store.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { copyEmbedCode } from '@/scripts/get-embed-code.js';
const props = defineProps<{ const props = defineProps<{
tag: string; tag: string;
@ -51,7 +52,19 @@ async function post() {
notes.value?.pagingComponent?.reload(); notes.value?.pagingComponent?.reload();
} }
const headerActions = computed(() => []); const headerActions = computed(() => [{
icon: 'ti ti-dots',
label: i18n.ts.more,
handler: (ev: MouseEvent) => {
os.popupMenu([{
text: i18n.ts.copyEmbedCode,
icon: 'ti ti-code',
action: () => {
copyEmbedCode('tags', props.tag);
},
}], ev.currentTarget ?? ev.target);
}
}]);
const headerTabs = computed(() => []); const headerTabs = computed(() => []);

View File

@ -13,16 +13,16 @@ import MkEmbedCodeGenDialog from '@/components/MkEmbedCodeGenDialog.vue';
const embeddableEntities = [ const embeddableEntities = [
'notes', 'notes',
'user-timeline', 'user-timeline',
'clip', 'clips',
'tag', 'tags',
] as const; ] as const;
export type EmbeddableEntity = typeof embeddableEntities[number]; export type EmbeddableEntity = typeof embeddableEntities[number];
// 内部でスクロールがあるページ // 内部でスクロールがあるページ
export const embedRouteWithScrollbar: EmbeddableEntity[] = [ export const embedRouteWithScrollbar: EmbeddableEntity[] = [
'clip', 'clips',
'tag', 'tags',
'user-timeline' 'user-timeline'
]; ];

View File

@ -316,19 +316,18 @@ export function getNoteMenu(props: {
action: () => { action: () => {
window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener'); window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
}, },
} : undefined, } : {
...(isSupportShare() ? [{
icon: 'ti ti-share',
text: i18n.ts.share,
action: share,
}] : []),
(!appearNote.url && !appearNote.uri) ? {
icon: 'ti ti-code', icon: 'ti ti-code',
text: i18n.ts.copyEmbedCode, text: i18n.ts.copyEmbedCode,
action: () => { action: () => {
copyEmbedCode('notes', appearNote.id); copyEmbedCode('notes', appearNote.id);
}, },
} : undefined, },
...(isSupportShare() ? [{
icon: 'ti ti-share',
text: i18n.ts.share,
action: share,
}] : []),
$i && $i.policies.canUseTranslator && instance.translatorAvailable ? { $i && $i.policies.canUseTranslator && instance.translatorAvailable ? {
icon: 'ti ti-language-hiragana', icon: 'ti ti-language-hiragana',
text: i18n.ts.translate, text: i18n.ts.translate,
@ -456,14 +455,20 @@ export function getNoteMenu(props: {
icon: 'ti ti-copy', icon: 'ti ti-copy',
text: i18n.ts.copyContent, text: i18n.ts.copyContent,
action: copyContent, action: copyContent,
}, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink) }, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink),
, (appearNote.url || appearNote.uri) ? { (appearNote.url || appearNote.uri) ? {
icon: 'ti ti-external-link', icon: 'ti ti-external-link',
text: i18n.ts.showOnRemote, text: i18n.ts.showOnRemote,
action: () => { action: () => {
window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener'); window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
}, },
} : undefined] } : {
icon: 'ti ti-code',
text: i18n.ts.copyEmbedCode,
action: () => {
copyEmbedCode('notes', appearNote.id);
},
}]
.filter(x => x !== undefined); .filter(x => x !== undefined);
} }