add vue-3-sanitize and linkifyjs to allow safe link formatting in notes
This commit is contained in:
@ -3,30 +3,31 @@
|
||||
<Card>
|
||||
<template #title>{{ $t('workouts.NOTES') }}</template>
|
||||
<template #content>
|
||||
{{ notes && notes !== '' ? notes : $t('workouts.NO_NOTES') }}
|
||||
<span v-html="notes !== '' ? $sanitize(linkifyStr(notes, { target: '_blank' })) : $t('workouts.NO_NOTES')" />
|
||||
</template>
|
||||
</Card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { toRefs, withDefaults } from 'vue'
|
||||
import linkifyStr from 'linkify-string'
|
||||
import { toRefs, withDefaults } from 'vue'
|
||||
|
||||
interface Props {
|
||||
notes?: string | null
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
notes: () => null,
|
||||
})
|
||||
interface Props {
|
||||
notes?: string | null
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
notes: () => null,
|
||||
})
|
||||
|
||||
const { notes } = toRefs(props)
|
||||
const { notes } = toRefs(props)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
#workout-note {
|
||||
::v-deep(.card-content) {
|
||||
font-style: italic;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
#workout-note {
|
||||
::v-deep(.card-content) {
|
||||
font-style: italic;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user