Hide share button if unavailable (closes #9175)
This commit is contained in:
parent
4c423ff06e
commit
f1a0dc70b2
|
@ -24,7 +24,7 @@
|
|||
<div class="other">
|
||||
<button v-if="$i && $i.id === post.user.id" v-tooltip="i18n.ts.edit" v-click-anime class="_button" @click="edit"><i class="ph-pencil-bold ph-lg ph-fw ph-lg"></i></button>
|
||||
<button v-tooltip="i18n.ts.shareWithNote" v-click-anime class="_button" @click="shareWithNote"><i class="ph-repeat-bold ph-lg ph-fw ph-lg"></i></button>
|
||||
<button v-tooltip="i18n.ts.share" v-click-anime class="_button" @click="share"><i class="ph-share-network-bold ph-lg ph-fw ph-lg"></i></button>
|
||||
<button v-if="shareAvailable()" v-tooltip="i18n.ts.share" v-click-anime class="_button" @click="share"><i class="ph-share-network-bold ph-lg ph-fw ph-lg"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user">
|
||||
|
@ -67,6 +67,7 @@ import { url } from '@/config';
|
|||
import { useRouter } from '@/router';
|
||||
import { i18n } from '@/i18n';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||
import { shareAvailable } from '@/scripts/share-available';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</div>
|
||||
<div class="other">
|
||||
<button v-tooltip="i18n.ts.shareWithNote" v-click-anime class="_button" @click="shareWithNote"><i class="ph-repeat-bold ph-lg ph-fw ph-lg"></i></button>
|
||||
<button v-tooltip="i18n.ts.share" v-click-anime class="_button" @click="share"><i class="ph-share-network-bold ph-lg ph-fw ph-lg"></i></button>
|
||||
<button v-if="shareAvailable()" v-tooltip="i18n.ts.share" v-click-anime class="_button" @click="share"><i class="ph-share-network-bold ph-lg ph-fw ph-lg"></i></button>
|
||||
</div>
|
||||
<div class="user">
|
||||
<MkAvatar :user="page.user" class="avatar"/>
|
||||
|
@ -81,6 +81,7 @@ import MkPagination from '@/components/MkPagination.vue';
|
|||
import MkPagePreview from '@/components/MkPagePreview.vue';
|
||||
import { i18n } from '@/i18n';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||
import { shareAvailable } from '@/scripts/share-available';
|
||||
|
||||
const props = defineProps<{
|
||||
pageName: string;
|
||||
|
|
|
@ -8,6 +8,7 @@ import * as os from '@/os';
|
|||
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
||||
import { url } from '@/config';
|
||||
import { noteActions } from '@/store';
|
||||
import { shareAvailable } from '@/scripts/share-available';
|
||||
|
||||
export function getNoteMenu(props: {
|
||||
note: misskey.entities.Note;
|
||||
|
@ -220,11 +221,11 @@ export function getNoteMenu(props: {
|
|||
window.open(appearNote.url || appearNote.uri, '_blank');
|
||||
},
|
||||
} : undefined,
|
||||
{
|
||||
shareAvailable() ? {
|
||||
icon: 'ph-share-network-bold ph-lg',
|
||||
text: i18n.ts.share,
|
||||
action: share,
|
||||
},
|
||||
} : undefined,
|
||||
instance.translatorAvailable ? {
|
||||
icon: 'ph-translate-bold ph-lg',
|
||||
text: i18n.ts.translate,
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
export function shareAvailable(): boolean {
|
||||
if (navigator.share) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
Loading…
Reference in New Issue