Update client app long form text component to be rich text and add new markdown viewer component
This commit is contained in:
parent
283b59d5fe
commit
7f064598a6
|
@ -2340,7 +2340,6 @@
|
||||||
"icon": "TextParagraph",
|
"icon": "TextParagraph",
|
||||||
"styles": ["size"],
|
"styles": ["size"],
|
||||||
"editable": true,
|
"editable": true,
|
||||||
"illegalChildren": ["section"],
|
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "field/longform",
|
"type": "field/longform",
|
||||||
|
@ -3385,5 +3384,18 @@
|
||||||
"key": "validation"
|
"key": "validation"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"markdownviewer": {
|
||||||
|
"name": "Markdown Viewer",
|
||||||
|
"icon": "TaskList",
|
||||||
|
"styles": ["size"],
|
||||||
|
"editable": true,
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"label": "Value",
|
||||||
|
"key": "value"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<script>
|
||||||
|
import { MarkdownViewer } from "@budibase/bbui"
|
||||||
|
import { getContext } from "svelte"
|
||||||
|
import Placeholder from "./Placeholder.svelte"
|
||||||
|
|
||||||
|
export let value
|
||||||
|
|
||||||
|
const component = getContext("component")
|
||||||
|
const { builderStore, styleable } = getContext("sdk")
|
||||||
|
const height = $component.styles?.normal?.height
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div use:styleable={$component.styles}>
|
||||||
|
{#if value}
|
||||||
|
<MarkdownViewer {value} {height} />
|
||||||
|
{:else if $builderStore.inBuilder}
|
||||||
|
<Placeholder />
|
||||||
|
{/if}
|
||||||
|
</div>
|
|
@ -1,7 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { CoreTextArea } from "@budibase/bbui"
|
import { CoreRichTextField } from "@budibase/bbui"
|
||||||
import Field from "./Field.svelte"
|
import Field from "./Field.svelte"
|
||||||
import { getContext } from "svelte"
|
|
||||||
|
|
||||||
export let field
|
export let field
|
||||||
export let label
|
export let label
|
||||||
|
@ -12,9 +11,6 @@
|
||||||
|
|
||||||
let fieldState
|
let fieldState
|
||||||
let fieldApi
|
let fieldApi
|
||||||
|
|
||||||
const component = getContext("component")
|
|
||||||
$: height = $component.styles?.normal?.height || "124px"
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Field
|
<Field
|
||||||
|
@ -28,8 +24,7 @@
|
||||||
bind:fieldApi
|
bind:fieldApi
|
||||||
>
|
>
|
||||||
{#if fieldState}
|
{#if fieldState}
|
||||||
<div style="--height: {height};">
|
<CoreRichTextField
|
||||||
<CoreTextArea
|
|
||||||
value={fieldState.value}
|
value={fieldState.value}
|
||||||
on:change={e => fieldApi.setValue(e.detail)}
|
on:change={e => fieldApi.setValue(e.detail)}
|
||||||
disabled={fieldState.disabled}
|
disabled={fieldState.disabled}
|
||||||
|
@ -37,17 +32,5 @@
|
||||||
id={fieldState.fieldId}
|
id={fieldState.fieldId}
|
||||||
{placeholder}
|
{placeholder}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
<style>
|
|
||||||
:global(.spectrum-Form-itemField .spectrum-Textfield--multiline) {
|
|
||||||
min-height: calc(var(--height) - 24px);
|
|
||||||
}
|
|
||||||
:global(.spectrum-Form--labelsAbove
|
|
||||||
.spectrum-Form-itemField
|
|
||||||
.spectrum-Textfield--multiline) {
|
|
||||||
min-height: calc(var(--height) - 24px);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ export { default as daterangepicker } from "./DateRangePicker.svelte"
|
||||||
export { default as cardstat } from "./CardStat.svelte"
|
export { default as cardstat } from "./CardStat.svelte"
|
||||||
export { default as spectrumcard } from "./SpectrumCard.svelte"
|
export { default as spectrumcard } from "./SpectrumCard.svelte"
|
||||||
export { default as tag } from "./Tag.svelte"
|
export { default as tag } from "./Tag.svelte"
|
||||||
|
export { default as markdownviewer } from "./MarkdownViewer.svelte"
|
||||||
export * from "./charts"
|
export * from "./charts"
|
||||||
export * from "./forms"
|
export * from "./forms"
|
||||||
export * from "./table"
|
export * from "./table"
|
||||||
|
|
Loading…
Reference in New Issue