copy button

This commit is contained in:
ThatOneCalculator 2022-12-05 23:44:41 -08:00
parent 025b598ed5
commit a52a9156f2
3 changed files with 9 additions and 1 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "calckey", "name": "calckey",
"version": "12.119.0-calc.19-b6", "version": "12.119.0-calc.19-b7",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -40,6 +40,7 @@ import bytes from '@/filters/bytes';
import * as os from '@/os'; import * as os from '@/os';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { $i } from '@/account'; import { $i } from '@/account';
import copyToClipboard from '@/scripts/copy-to-clipboard';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
file: Misskey.entities.DriveFile; file: Misskey.entities.DriveFile;

View file

@ -15,6 +15,7 @@
<h1>{{ page.title }}</h1> <h1>{{ page.title }}</h1>
</div> </div>
<div class="menu-actions"> <div class="menu-actions">
<button v-tooltip="i18n.ts.copyUrl" @click="copyUrl" class="menu _button"><i class="ph-link-simple-bold ph-lg"/></button>
<MkA v-tooltip="i18n.ts._pages.viewSource" :to="`/@${username}/pages/${pageName}/view-source`" class="menu _button"><i class="ph-code-bold ph-lg"/></MkA> <MkA v-tooltip="i18n.ts._pages.viewSource" :to="`/@${username}/pages/${pageName}/view-source`" class="menu _button"><i class="ph-code-bold ph-lg"/></MkA>
<template v-if="$i && $i.id === page.userId"> <template v-if="$i && $i.id === page.userId">
<MkA v-tooltip="i18n.ts._pages.editPage" class="menu _button" :to="`/pages/edit/${page.id}`"><i class="ph-pencil-bold ph-lg"/></MkA> <MkA v-tooltip="i18n.ts._pages.editPage" class="menu _button" :to="`/pages/edit/${page.id}`"><i class="ph-pencil-bold ph-lg"/></MkA>
@ -80,6 +81,7 @@ import MkContainer from '@/components/MkContainer.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination from '@/components/MkPagination.vue';
import MkPagePreview from '@/components/MkPagePreview.vue'; import MkPagePreview from '@/components/MkPagePreview.vue';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import copyToClipboard from '@/scripts/copy-to-clipboard';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
import { shareAvailable } from '@/scripts/share-available'; import { shareAvailable } from '@/scripts/share-available';
@ -113,6 +115,11 @@ function fetchPage() {
}); });
} }
function copyUrl() {
copyToClipboard(window.location.href);
os.success();
}
function getBgImg(): string { function getBgImg(): string {
if (page.eyeCatchingImage != null) { if (page.eyeCatchingImage != null) {
return `url(${page.eyeCatchingImage.url})`; return `url(${page.eyeCatchingImage.url})`;