Skip to content

Commit

Permalink
Markdown in description (#3665)
Browse files Browse the repository at this point in the history
* Update SchemaField.tsx

Show markdown in the field description field

* Update FieldTemplates

Make field template consistent for all the themes so they all show description

* Updated sample data and documentation about the markdown in `RJSFSchema` description

* Add enableMarkdownInDescription flag

Added flag to uiOptions for enabling markdown rendering

* Update CHANGELOG.md

Move notes into a new section

* Update test snapshots

Update all the snapshots in the project because of the failing tests.

* Update CHANGELOG.md

moved remaining description under correct version

* Update FieldTemplate

Change conditions for all the themes

* Update test snapshots
  • Loading branch information
dejanbelusic authored May 26, 2023
1 parent ee72a2f commit 76b82d1
Show file tree
Hide file tree
Showing 26 changed files with 1,696 additions and 641 deletions.
36 changes: 35 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,40 @@ should change the heading of the (upcoming) version to include a major version b
-->

# 5.8.0

## @rjsf/bootstrap-4

- Updated FieldTemplate Component to display description from SchemaField and make it consistent for all the available themes

## @rjsf/chakra-ui

- Updated FieldTemplate Component to display description from SchemaField and make it consistent for all the available themes

## @rjsf/fluent-ui

- Updated FieldTemplate Component to display description from SchemaField and make it consistent for all the available themes

## @rjsf/material-ui

- Updated FieldTemplate Component to display description from SchemaField and make it consistent for all the available themes

## @rjsf/mui

- Updated FieldTemplate Component to display description from SchemaField and make it consistent for all the available themes

## @rjsf/semantic-ui

- Updated FieldTemplate Component to display description from SchemaField and make it consistent for all the available themes

## @rjsf/core

- Updated SchemaField to be able to render markdown in the description field

## Dev / docs / playground

- Updated sample data and documentation about the markdown in `RJSFSchema` description

# 5.7.3

## @rjsf/utils
Expand Down Expand Up @@ -58,7 +92,7 @@ should change the heading of the (upcoming) version to include a major version b
## @rjsf/core

- Updated the `MultiSchemaField` to use the new `getDiscriminatorFieldFromSchema()` API
- Added new `experimental_defaultFormStateBehavior` prop to `Form`
- Added new `experimental_defaultFormStateBehavior` prop to `Form`
- to specify alternate behavior when dealing with the rendering of array fields where `minItems` is set but field is not `required` (fixes [#3363](https://github.com/rjsf-team/react-jsonschema-form/issues/3363)) ([#3602](https://github.com/rjsf-team/react-jsonschema-form/issues/3602))
- to handle setting object defaults based on the value of `emptyObjectFields` supporting required fields only and skipping defaults entirely, fixing [#2980](https://github.com/rjsf-team/react-jsonschema-form/issues/2980)
- Fixed regression [#3650](https://github.com/rjsf-team/react-jsonschema-form/issues/3650) in `FileWidget` to again support adding multiple files to arrays
Expand Down
3 changes: 2 additions & 1 deletion packages/bootstrap-4/src/FieldTemplate/FieldTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default function FieldTemplate<
rawErrors = [],
errors,
help,
description,
rawDescription,
classNames,
style,
Expand Down Expand Up @@ -66,7 +67,7 @@ export default function FieldTemplate<
)}
{children}
{displayLabel && rawDescription && (
<Form.Text className={rawErrors.length > 0 ? 'text-danger' : 'text-muted'}>{rawDescription}</Form.Text>
<Form.Text className={rawErrors.length > 0 ? 'text-danger' : 'text-muted'}>{description}</Form.Text>
)}
{errors}
{help}
Expand Down
144 changes: 128 additions & 16 deletions packages/bootstrap-4/test/__snapshots__/Array.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,14 @@ exports[`with title and description array icons 1`] = `
<small
className="text-muted form-text"
>
a test item description
<div>
<div
className="mb-3"
id="root_0__description"
>
a test item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -1490,7 +1497,14 @@ exports[`with title and description array icons 1`] = `
<small
className="text-muted form-text"
>
a test item description
<div>
<div
className="mb-3"
id="root_1__description"
>
a test item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -1791,7 +1805,14 @@ exports[`with title and description checkboxes 1`] = `
<small
className="text-muted form-text"
>
a test description
<div>
<div
className="mb-3"
id="root__description"
>
a test description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -1892,7 +1913,14 @@ exports[`with title and description fixed array 1`] = `
<small
className="text-muted form-text"
>
a test item description
<div>
<div
className="mb-3"
id="root_0__description"
>
a test item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -1942,7 +1970,14 @@ exports[`with title and description fixed array 1`] = `
<small
className="text-muted form-text"
>
a test item description
<div>
<div
className="mb-3"
id="root_1__description"
>
a test item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -2172,7 +2207,14 @@ exports[`with title and description from both array icons 1`] = `
<small
className="text-muted form-text"
>
a fancier item description
<div>
<div
className="mb-3"
id="root_0__description"
>
a fancier item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -2384,7 +2426,14 @@ exports[`with title and description from both array icons 1`] = `
<small
className="text-muted form-text"
>
a fancier item description
<div>
<div
className="mb-3"
id="root_1__description"
>
a fancier item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -2685,7 +2734,14 @@ exports[`with title and description from both checkboxes 1`] = `
<small
className="text-muted form-text"
>
a fancier description
<div>
<div
className="mb-3"
id="root__description"
>
a fancier description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -2786,7 +2842,14 @@ exports[`with title and description from both fixed array 1`] = `
<small
className="text-muted form-text"
>
a fancier item description
<div>
<div
className="mb-3"
id="root_0__description"
>
a fancier item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -2836,7 +2899,14 @@ exports[`with title and description from both fixed array 1`] = `
<small
className="text-muted form-text"
>
a fancier item description
<div>
<div
className="mb-3"
id="root_1__description"
>
a fancier item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -3066,7 +3136,14 @@ exports[`with title and description from uiSchema array icons 1`] = `
<small
className="text-muted form-text"
>
a fancier item description
<div>
<div
className="mb-3"
id="root_0__description"
>
a fancier item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -3278,7 +3355,14 @@ exports[`with title and description from uiSchema array icons 1`] = `
<small
className="text-muted form-text"
>
a fancier item description
<div>
<div
className="mb-3"
id="root_1__description"
>
a fancier item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -3579,7 +3663,14 @@ exports[`with title and description from uiSchema checkboxes 1`] = `
<small
className="text-muted form-text"
>
a fancier description
<div>
<div
className="mb-3"
id="root__description"
>
a fancier description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -3680,7 +3771,14 @@ exports[`with title and description from uiSchema fixed array 1`] = `
<small
className="text-muted form-text"
>
a fancier item description
<div>
<div
className="mb-3"
id="root_0__description"
>
a fancier item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -3730,7 +3828,14 @@ exports[`with title and description from uiSchema fixed array 1`] = `
<small
className="text-muted form-text"
>
a fancier item description
<div>
<div
className="mb-3"
id="root_1__description"
>
a fancier item description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -4401,7 +4506,14 @@ exports[`with title and description with global label off checkboxes 1`] = `
<small
className="text-muted form-text"
>
a test description
<div>
<div
className="mb-3"
id="root__description"
>
a test description
</div>
</div>
</small>
</div>
</div>
Expand Down
18 changes: 16 additions & 2 deletions packages/bootstrap-4/test/__snapshots__/Form.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,14 @@ exports[`single fields field with description 1`] = `
<small
className="text-muted form-text"
>
some description
<div>
<div
className="mb-3"
id="root_my-field__description"
>
some description
</div>
</div>
</small>
</div>
</div>
Expand Down Expand Up @@ -379,7 +386,14 @@ exports[`single fields field with description in uiSchema 1`] = `
<small
className="text-muted form-text"
>
some other description
<div>
<div
className="mb-3"
id="root_my-field__description"
>
some other description
</div>
</div>
</small>
</div>
</div>
Expand Down
Loading

0 comments on commit 76b82d1

Please sign in to comment.