1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-09 15:17:50 +00:00
bramw_baserow/web-frontend/modules/database/components/view/grid/fields/FunctionalGridViewFieldRichText.vue

29 lines
803 B
Vue

<!-- eslint-disable vue/no-v-html -->
<template functional>
<div
class="field-rich-text--preview grid-view__cell grid-field-rich-text__cell"
v-html="$options.methods.renderFormattedValue(props.value)"
></div>
</template>
<script>
import { parseMarkdown } from '@baserow/modules/core/editor/markdown'
export default {
name: 'FunctionalGridViewFieldRichText',
methods: {
renderFormattedValue(value) {
// Take only a part of the text as a preview to avoid rendering a huge amount of
// HTML that could slow down the page and won't be visible anyway
let preview = ''
if (value) {
preview = value.substring(0, 200)
if (value.length > 200) {
preview += '...'
}
}
return parseMarkdown(preview)
},
},
}
</script>