1
0
forked from mirror/misskey
This commit is contained in:
syuilo 2019-05-27 18:01:06 +09:00
parent 5dbe1d448b
commit 8e8428b667
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69

View File

@ -9,7 +9,7 @@
</blockquote> </blockquote>
</div> </div>
<div v-else class="mk-url-preview"> <div v-else class="mk-url-preview">
<component :is="self ? 'router-link' : 'a'" :class="{ mini: narrow, compact }" :[attr]="self ? url.substr(local.length) : url" rel="nofollow noopener" :target="self ? null : '_blank'" :title="url" v-if="!fetching"> <component :is="hasRoute ? 'router-link' : 'a'" :class="{ mini: narrow, compact }" :[attr]="hasRoute ? url.substr(local.length) : url" rel="nofollow noopener" :target="target" :title="url" v-if="!fetching">
<div class="thumbnail" v-if="thumbnail" :style="`background-image: url('${thumbnail}')`"> <div class="thumbnail" v-if="thumbnail" :style="`background-image: url('${thumbnail}')`">
<button v-if="!playerEnabled && player.url" @click.prevent="playerEnabled = true" :title="$t('enable-player')"><fa :icon="['far', 'play-circle']"/></button> <button v-if="!playerEnabled && player.url" @click.prevent="playerEnabled = true" :title="$t('enable-player')"><fa :icon="['far', 'play-circle']"/></button>
</div> </div>
@ -61,7 +61,13 @@ export default Vue.extend({
}, },
data() { data() {
const isSelf = this.url.startsWith(local);
const hasRoute =
this.url.substr(local.length).startsWith('/@') ||
this.url.substr(local.length).startsWith('/notes/') ||
this.url.substr(local.length).startsWith('/pages/');
return { return {
local,
fetching: true, fetching: true,
title: null, title: null,
description: null, description: null,
@ -75,9 +81,10 @@ export default Vue.extend({
}, },
tweetUrl: null, tweetUrl: null,
playerEnabled: false, playerEnabled: false,
local, self: isSelf,
self: this.url.startsWith(local), hasRoute: hasRoute,
attr: this.url.startsWith(local) ? 'to' : 'href' attr: hasRoute ? 'to' : 'href',
target: hasRoute ? null : '_blank'
}; };
}, },