ADD: internal links

Internal links for richtext
This commit is contained in:
webfussel 2025-02-21 20:08:19 +01:00
parent 9a1b1acfee
commit d8593a7280
2 changed files with 17 additions and 4 deletions

View file

@ -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>