-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Feature: added the ui:enableMarkdownInHelp flag in UiSchema #4855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature: added the ui:enableMarkdownInHelp flag in UiSchema #4855
Conversation
6e9390a to
e7391fd
Compare
|
Hi @heath-freenome , all the test cases for this PR have passed successfully. Could you please review it when you get the chance and let me know if any further changes or improvements are needed before merging? |
e7391fd to
b337908
Compare
heath-freenome
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please add test to formTest.tsx in snapshot-tests to verify the markdown help
packages/daisyui/src/templates/FieldHelpTemplate/FieldHelpTemplate.tsx
Outdated
Show resolved
Hide resolved
packages/primereact/src/FieldHelpTemplate/FieldHelpTemplate.tsx
Outdated
Show resolved
Hide resolved
packages/react-bootstrap/src/FieldHelpTemplate/FieldHelpTemplate.tsx
Outdated
Show resolved
Hide resolved
packages/semantic-ui/src/FieldHelpTemplate/FieldHelpTemplate.tsx
Outdated
Show resolved
Hide resolved
packages/semantic-ui/src/FieldHelpTemplate/FieldHelpTemplate.tsx
Outdated
Show resolved
Hide resolved
| colon={colon} | ||
| hasFeedback={schema.type !== 'array' && schema.type !== 'object'} | ||
| help={(!!rawHelp && help) || (rawErrors?.length ? errors : undefined)} | ||
| help={help || (rawErrors?.length ? errors : undefined)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about this change... Why remove !!rawHelp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Suyog241005 Still wondering about this...
packages/daisyui/src/templates/FieldHelpTemplate/FieldHelpTemplate.tsx
Outdated
Show resolved
Hide resolved
packages/fluentui-rc/src/FieldHelpTemplate/FieldHelpTemplate.tsx
Outdated
Show resolved
Hide resolved
packages/primereact/src/FieldHelpTemplate/FieldHelpTemplate.tsx
Outdated
Show resolved
Hide resolved
packages/react-bootstrap/src/FieldHelpTemplate/FieldHelpTemplate.tsx
Outdated
Show resolved
Hide resolved
398ab33 to
17938e6
Compare
|
@Suyog241005 If you could respond to my questions I've left in the review, I'd appreciate it |
|
@heath-freenome I’ve updated the changelog as requested. Please let me know if anything else needs adjustment. |
heath-freenome
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more changes
| const uiOptions = getUiOptions<T, S, F>(uiSchema, registry?.globalUiOptions); | ||
| if (typeof help === 'string' && uiOptions.enableMarkdownInHelp) { | ||
| return ( | ||
| <div id={id} className='help-block'> | ||
| <Markdown options={{ disableParsingRawHTML: true }}>{help}</Markdown> | ||
| </div> | ||
| ); | ||
| } | ||
| if (typeof help === 'string') { | ||
| return ( | ||
| <p id={id} className='help-block'> | ||
| {help} | ||
| </p> | ||
| ); | ||
| } | ||
| return ( | ||
| <div id={id} className='help-block'> | ||
| {help} | ||
| </div> | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify this down to just this:
| const uiOptions = getUiOptions<T, S, F>(uiSchema, registry?.globalUiOptions); | |
| if (typeof help === 'string' && uiOptions.enableMarkdownInHelp) { | |
| return ( | |
| <div id={id} className='help-block'> | |
| <Markdown options={{ disableParsingRawHTML: true }}>{help}</Markdown> | |
| </div> | |
| ); | |
| } | |
| if (typeof help === 'string') { | |
| return ( | |
| <p id={id} className='help-block'> | |
| {help} | |
| </p> | |
| ); | |
| } | |
| return ( | |
| <div id={id} className='help-block'> | |
| {help} | |
| </div> | |
| ); | |
| return ( | |
| <div id={id} className='help-block'> | |
| <Markdown options={{ disableParsingRawHTML: true }}>{help}</Markdown> | |
| </div> | |
| ); |
| if (typeof help === 'string') { | ||
| return ( | ||
| <p id={id} className='help-block'> | ||
| <p id={helpId(fieldPathId)} className='help-block'> | ||
| {help} | ||
| </p> | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this section... We don't need the <p> version
| return ( | ||
| <Form.Text className={hasErrors ? 'text-danger' : 'text-muted'} id={id}> | ||
| {help} | ||
| <Form.Text id={helpId(fieldPathId)} className='text-muted'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please restore the text-danger logic
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
cbae16f to
c918d74
Compare
…estored text-danger logic in Bootstrap FieldHelpTemplate & updated core test to expect div.help-block instead of p.help-block
c918d74 to
472829c
Compare
|
Hi @heath-freenome, I’ve implemented all the requested changes. Could you please review the latest updates when you get a chance? |
Reasons for making this change
This PR implements the ability to render markdown in help text fields across all themes by introducing a new
ui:enableMarkdownInHelpflag, similar to the existingui:enableMarkdownInDescriptionfunctionality.-Updated all theme packages to support markdown in help text
Fixes 4601
Checklist
npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:updateto update snapshots, if needed.