copy button

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

View file

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

View file

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

View file

@ -15,6 +15,7 @@
<h1>{{ page.title }}</h1>
</div>
<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>
<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>
@ -80,6 +81,7 @@ import MkContainer from '@/components/MkContainer.vue';
import MkPagination from '@/components/MkPagination.vue';
import MkPagePreview from '@/components/MkPagePreview.vue';
import { i18n } from '@/i18n';
import copyToClipboard from '@/scripts/copy-to-clipboard';
import { definePageMetadata } from '@/scripts/page-metadata';
import { shareAvailable } from '@/scripts/share-available';
@ -113,6 +115,11 @@ function fetchPage() {
});
}
function copyUrl() {
copyToClipboard(window.location.href);
os.success();
}
function getBgImg(): string {
if (page.eyeCatchingImage != null) {
return `url(${page.eyeCatchingImage.url})`;