0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-29 22:53:05 +00:00
VueTube/NUXT/components/UtilRenderers/YtTextFormatter.vue

63 lines
1.4 KiB
Vue
Raw Normal View History

<template>
2022-04-22 04:38:21 +00:00
<div class="yt-text-formatter">
<template v-for="(text, index) in textRuns">
<template v-if="$rendererUtils.checkInternal(text)">
<a
2022-05-05 05:32:02 +00:00
@click.stop.prevent="
openInternal($rendererUtils.getNavigationEndpoints(text))
"
:key="index"
>{{ text.text }}</a
>
</template>
<template
v-else-if="
text.navigationEndpoint && text.navigationEndpoint.urlEndpoint
"
>
<a
2022-05-05 05:32:02 +00:00
@click.stop.prevent="
openExternal($rendererUtils.getNavigationEndpoints(text))
"
:key="index"
>{{ text.text }}</a
>
</template>
<template v-else-if="text.emoji && text.emoji.isCustomEmoji">
<img
:src="
text.emoji.image.thumbnails[text.emoji.image.thumbnails.length - 1]
.url
"
:alt="text.text"
:key="index"
class="emoji"
draggable="false"
/>
</template>
2022-04-22 04:38:21 +00:00
<template v-else>
<span :key="index" v-emoji>{{ text.text }}</span>
</template>
</template>
</div>
</template>
<script>
export default {
props: {
textRuns: {
type: Array,
default: () => [],
},
},
2022-04-22 04:38:21 +00:00
methods: {
openExternal(url) {
this.$vuetube.openExternal(url);
2022-04-22 04:38:21 +00:00
},
async openInternal(url) {
await this.$router.push(url);
},
},
};
</script>