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

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;
/**
*
*
*/
"noteOfThisUser": string;
"_delivery": {

View file

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

View file

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

View file

@ -28,6 +28,7 @@ import { i18n } from '@/i18n.js';
import { $i } from '@/account.js';
import { defaultStore } from '@/store.js';
import * as os from '@/os.js';
import { copyEmbedCode } from '@/scripts/get-embed-code.js';
const props = defineProps<{
tag: string;
@ -51,7 +52,19 @@ async function post() {
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(() => []);

View file

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

View file

@ -316,19 +316,18 @@ export function getNoteMenu(props: {
action: () => {
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',
text: i18n.ts.copyEmbedCode,
action: () => {
copyEmbedCode('notes', appearNote.id);
},
} : undefined,
},
...(isSupportShare() ? [{
icon: 'ti ti-share',
text: i18n.ts.share,
action: share,
}] : []),
$i && $i.policies.canUseTranslator && instance.translatorAvailable ? {
icon: 'ti ti-language-hiragana',
text: i18n.ts.translate,
@ -456,14 +455,20 @@ 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 || appearNote.uri) ? {
icon: 'ti ti-external-link',
text: i18n.ts.showOnRemote,
action: () => {
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);
}