summaryrefslogtreecommitdiff
path: root/src/client/app/common/views/components/url-preview.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/app/common/views/components/url-preview.vue')
-rw-r--r--src/client/app/common/views/components/url-preview.vue11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/client/app/common/views/components/url-preview.vue b/src/client/app/common/views/components/url-preview.vue
index 9ca4497ad8..6e0d73eef5 100644
--- a/src/client/app/common/views/components/url-preview.vue
+++ b/src/client/app/common/views/components/url-preview.vue
@@ -9,7 +9,7 @@
</blockquote>
</div>
<div v-else class="mk-url-preview">
- <a :class="{ mini: narrow, compact }" :href="url" rel="nofollow noopener" target="_blank" :title="url" v-if="!fetching">
+ <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">
<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>
</div>
@@ -23,17 +23,18 @@
<p :title="sitename">{{ sitename }}</p>
</footer>
</article>
- </a>
+ </component>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
-import { url as misskeyUrl } from '../../../config';
+import { url as local } from '../../../config';
export default Vue.extend({
i18n: i18n('common/views/components/url-preview.vue'),
+
props: {
url: {
type: String,
@@ -74,7 +75,9 @@ export default Vue.extend({
},
tweetUrl: null,
playerEnabled: false,
- misskeyUrl,
+ local,
+ self: this.url.startsWith(local),
+ attr: this.url.startsWith(local) ? 'to' : 'href'
};
},