1
0
Fork 0
mirror of https://github.com/paricafe/misskey.git synced 2025-03-31 14:29:28 -05:00

chore(frontend): use toast to show message when call copyToClipboard

This commit is contained in:
syuilo 2025-03-16 15:04:38 +09:00
parent 32844e4775
commit 81a0cbd294
21 changed files with 16 additions and 27 deletions

4
locales/index.d.ts vendored
View file

@ -2810,6 +2810,10 @@ export interface Locale extends ILocale {
*
*/
"copy": string;
/**
*
*/
"copiedToClipboard": string;
/**
*
*/

View file

@ -698,6 +698,7 @@ userSaysSomethingAbout: "{name}が「{word}」について何かを言いまし
makeActive: "アクティブにする"
display: "表示"
copy: "コピー"
copiedToClipboard: "クリップボードにコピーされました"
metrics: "メトリクス"
overview: "概要"
logs: "ログ"

View file

@ -48,7 +48,6 @@ const XCode = defineAsyncComponent(() => import('@/components/MkCode.core.vue'))
function copy() {
copyToClipboard(props.code);
os.success();
}
</script>

View file

@ -194,7 +194,6 @@ function generate() {
function doCopy() {
copyToClipboard(result.value);
os.success();
}
//#endregion

View file

@ -90,7 +90,6 @@ function deleteCode() {
function copyInviteCode() {
copyToClipboard(props.invite.code);
os.success();
}
</script>

View file

@ -31,7 +31,6 @@ const props = withDefaults(defineProps<{
const copy_ = () => {
copyToClipboard(props.copy);
os.success();
};
</script>

View file

@ -100,7 +100,6 @@ function onClick(ev: MouseEvent) {
icon: 'ti ti-copy',
action: () => {
copyToClipboard(`:${props.name}:`);
os.success();
},
});

View file

@ -50,7 +50,6 @@ function onClick(ev: MouseEvent) {
icon: 'ti ti-copy',
action: () => {
copyToClipboard(props.emoji);
os.success();
},
});

View file

@ -63,7 +63,6 @@ export const apiWithDialog = (<E extends keyof Misskey.Endpoints, P extends Miss
});
if (result === 'copy') {
copyToClipboard(`Endpoint: ${endpoint}\nInfo: ${JSON.stringify(err.info)}\nDate: ${date}`);
success();
}
return;
} else if (err.code === 'RATE_LIMIT_EXCEEDED') {

View file

@ -210,7 +210,6 @@ const headerActions = computed(() => {
return;
}
copyToClipboard(`${url}/channels/${channel.value.id}`);
os.success();
},
});

View file

@ -148,7 +148,6 @@ const headerActions = computed(() => clip.value && isOwned.value ? [{
text: i18n.ts.copyUrl,
action: () => {
copyToClipboard(`${url}/clips/${clip.value!.id}`);
os.success();
},
}, {
icon: 'ti ti-code',

View file

@ -849,7 +849,6 @@ function exportLog() {
l: DropAndFusionGame.serializeLogs(logs),
});
copyToClipboard(data);
os.success();
}
function updateSettings<

View file

@ -25,7 +25,7 @@ import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialo
import { $i } from '@/i.js';
const props = defineProps<{
emoji: Misskey.entities.EmojiSimple;
emoji: Misskey.entities.EmojiSimple;
}>();
function menu(ev) {
@ -38,7 +38,6 @@ function menu(ev) {
icon: 'ti ti-copy',
action: () => {
copyToClipboard(`:${props.emoji.name}:`);
os.success();
},
}, {
text: i18n.ts.info,

View file

@ -129,7 +129,6 @@ function copyLink() {
if (!flash.value) return;
copyToClipboard(`${url}/play/${flash.value.id}`);
os.success();
}
function shareWithNavigator() {

View file

@ -111,7 +111,6 @@ function fetchPost() {
function copyLink() {
copyToClipboard(`${url}/gallery/${post.value.id}`);
os.success();
}
function share() {

View file

@ -190,7 +190,6 @@ function copyLink() {
if (!page.value) return;
copyToClipboard(`${url}/@${page.value.user.username}/pages/${page.value.name}`);
os.success();
}
function shareWithNote() {

View file

@ -33,12 +33,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, ref } from 'vue';
import JSON5 from 'json5';
import type { Theme } from '@/theme.js';
import MkTextarea from '@/components/MkTextarea.vue';
import MkSelect from '@/components/MkSelect.vue';
import MkInput from '@/components/MkInput.vue';
import MkButton from '@/components/MkButton.vue';
import { getBuiltinThemesRef } from '@/theme.js';
import type { Theme } from '@/theme.js';
import { copyToClipboard } from '@/utility/copy-to-clipboard.js';
import * as os from '@/os.js';
import { getThemes, removeTheme } from '@/theme-store.js';
@ -63,7 +63,6 @@ const selectedThemeCode = computed(() => {
function copyThemeCode() {
copyToClipboard(selectedThemeCode.value);
os.success();
}
function uninstall() {

View file

@ -3,9 +3,15 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
/**
* Clipboardに値をコピー(TODO: 文字列以外も対応)
*/
export function copyToClipboard(input: string | null) {
if (input) navigator.clipboard.writeText(input);
if (input) {
navigator.clipboard.writeText(input);
os.toast(i18n.ts.copiedToClipboard);
}
};

View file

@ -65,7 +65,6 @@ function toggleSensitive(file: Misskey.entities.DriveFile) {
function copyUrl(file: Misskey.entities.DriveFile) {
copyToClipboard(file.url);
os.success();
}
/*

View file

@ -4,11 +4,11 @@
*/
import { defineAsyncComponent } from 'vue';
import { v4 as uuid } from 'uuid';
import type { EmbedParams, EmbeddableEntity } from '@@/js/embed-page.js';
import { url } from '@@/js/config.js';
import { defaultEmbedParams, embedRouteWithScrollbar } from '@@/js/embed-page.js';
import type { EmbedParams, EmbeddableEntity } from '@@/js/embed-page.js';
import * as os from '@/os.js';
import { copyToClipboard } from '@/utility/copy-to-clipboard.js';
import { defaultEmbedParams, embedRouteWithScrollbar } from '@@/js/embed-page.js';
const MOBILE_THRESHOLD = 500;
@ -74,7 +74,6 @@ export function genEmbedCode(entity: EmbeddableEntity, id: string, params?: Embe
// PCじゃない場合はコードカスタマイズ画面を出さずにそのままコピー
if (window.innerWidth < MOBILE_THRESHOLD) {
copyToClipboard(getEmbedCode(`/embed/${entity}/${id}`, _params));
os.success();
} else {
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkEmbedCodeGenDialog.vue')), {
entity,

View file

@ -157,7 +157,6 @@ export function getCopyNoteLinkMenu(note: Misskey.entities.Note, text: string):
text,
action: (): void => {
copyToClipboard(`${url}/notes/${note.id}`);
os.success();
},
};
}
@ -237,7 +236,6 @@ export function getNoteMenu(props: {
function copyContent(): void {
copyToClipboard(appearNote.text);
os.success();
}
function togglePin(pin: boolean): void {
@ -324,7 +322,6 @@ export function getNoteMenu(props: {
text: i18n.ts.copyRemoteLink,
action: () => {
copyToClipboard(appearNote.url ?? appearNote.uri);
os.success();
},
}, {
icon: 'ti ti-external-link',
@ -483,7 +480,6 @@ export function getNoteMenu(props: {
text: i18n.ts.copyRemoteLink,
action: () => {
copyToClipboard(appearNote.url ?? appearNote.uri);
os.success();
},
}, {
icon: 'ti ti-external-link',
@ -516,7 +512,6 @@ export function getNoteMenu(props: {
text: i18n.ts.copyNoteId,
action: () => {
copyToClipboard(appearNote.id);
os.success();
},
});
}