Add rich text option to long form data type

This commit is contained in:
Andrew Kingston 2022-02-07 12:04:43 +00:00
parent 9aa1e5cf43
commit a96ef98e39
2 changed files with 20 additions and 2 deletions

View File

@ -7,6 +7,7 @@
Multiselect, Multiselect,
Label, Label,
RichTextField, RichTextField,
TextArea,
} from "@budibase/bbui" } from "@budibase/bbui"
import Dropzone from "components/common/Dropzone.svelte" import Dropzone from "components/common/Dropzone.svelte"
import { capitalise } from "helpers" import { capitalise } from "helpers"
@ -43,7 +44,11 @@
{:else if type === "link"} {:else if type === "link"}
<LinkedRowSelector bind:linkedRows={value} schema={meta} /> <LinkedRowSelector bind:linkedRows={value} schema={meta} />
{:else if type === "longform"} {:else if type === "longform"}
<RichTextField {label} height="200px" bind:value /> {#if meta.useRichText}
<RichTextField {label} height="150px" bind:value />
{:else}
<TextArea {label} height="150px" bind:value />
{/if}
{:else if type === "json"} {:else if type === "json"}
<Label>{label}</Label> <Label>{label}</Label>
<Editor <Editor

View File

@ -367,7 +367,7 @@
{#if canBeSearched && !external} {#if canBeSearched && !external}
<div> <div>
<Label grey small>Search Indexes</Label> <Label>Search Indexes</Label>
<Toggle <Toggle
value={indexes[0] === field.name} value={indexes[0] === field.name}
disabled={indexes[1] === field.name} disabled={indexes[1] === field.name}
@ -394,6 +394,19 @@
label="Options (one per line)" label="Options (one per line)"
bind:values={field.constraints.inclusion} bind:values={field.constraints.inclusion}
/> />
{:else if field.type === "longform"}
<div>
<Label
size="M"
tooltip="Rich text includes support for images, links, tables, lists and more"
>
Formatting
</Label>
<Toggle
bind:value={field.useRichText}
text="Enable rich text support (markdown)"
/>
</div>
{:else if field.type === "array"} {:else if field.type === "array"}
<ValuesList <ValuesList
label="Options (one per line)" label="Options (one per line)"