ADD: internal links
Internal links for richtext
This commit is contained in:
parent
9a1b1acfee
commit
d8593a7280
2 changed files with 17 additions and 4 deletions
|
@ -1,8 +1,12 @@
|
|||
<template>
|
||||
<a :href="href" :target="target" class="text inline-flex-row">
|
||||
<a v-if="isExternal" :href="href" :target="target" class="text inline-flex-row">
|
||||
{{ content }}
|
||||
<Icon :name="`ph:${linkIcon}-duotone`" mode="svg" />
|
||||
<Icon :name="`ph:arrow-square-out-duotone`" mode="svg" />
|
||||
</a>
|
||||
<NuxtLink v-else :to="href" class="text inline-flex-row">
|
||||
{{ content }}
|
||||
<Icon :name="`ph:link-simple-duotone`" mode="svg" />
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
@ -10,5 +14,5 @@ import type { RichTextLink } from './Types'
|
|||
|
||||
const { href } = defineProps<RichTextLink>()
|
||||
|
||||
const linkIcon = href.startsWith('http') ? 'globe' : 'arrow-square-in'
|
||||
const isExternal = href.startsWith('http')
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue