Files
baserow/web-frontend/modules/builder/components/elements/baseComponents/ABPlainText.vue
Tsering Paljor 674e4b12a8 feat: Add markdown support to more Builder elements (#6124)
* WIP

* Remove formula conversion related changes

* Move the file input click guard to formatted text component

* Move format types into their own components

* Use a shared markdown-it instance

* Move the formatter into data explorer

* Move minification logic into BaserowFormulaMinified

* Renderer should own the root element

* Ensure long choice names are truncated

* Ensure line height doesn't grow for paragraphs

* Add tests

* Add changelog

* Add specific tests for choice element
2026-10-09 09:36:32 +04:00

46 lines
1.1 KiB
Vue

<template>
<span v-if="isInline">{{ value }}</span>
<div v-else>
<ABParagraph v-for="paragraph in paragraphs" :key="paragraph.id">
{{ paragraph.content }}
</ABParagraph>
</div>
</template>
<script>
import formattedTextRenderer from '@baserow/modules/builder/mixins/formattedTextRenderer'
import { generateHash } from '@baserow/modules/core/utils/hashing'
/**
* @typedef Paragraph
* @property {string} content - The text of the paragraph
* @property {string} id - A hash identifying the paragraph
*/
/**
* The plain text renderer of `ABFormattedText`: the value as it is in a `span`
* in the inline profile, one paragraph per line in a `div` in the block
* profile.
*/
export default {
name: 'ABPlainText',
mixins: [formattedTextRenderer],
computed: {
/**
* The value split into paragraphs, for the block profile.
* @returns {Array.<Paragraph>}
*/
paragraphs() {
return this.value
.split('\n')
.map((line) => line.trim())
.filter((line) => line)
.map((line, index) => ({
content: line,
id: generateHash(line + index),
}))
},
},
}
</script>