Closed simoneb closed 2 years ago
<MDEditor
value={value}
textareaProps={{
name: 'field'
}}
onChange={setValue}
/>
@simoneb
<MDEditor
value={value}
+ textareaProps={{
+ name: 'field'
+ }}
onChange={setValue}
/>
Having played around with this I think more changes would be needed to make it work directly with formik. The onChange
callback would need to take a html form event and I'm not sure how feasible this is?
Is there a reason that onChange
is excluded from textareaProps
? https://github.com/uiwjs/react-md-editor/blob/4b7cc43437585c3843c0cef0d2b4d2d7a39f17fc/src/components/TextArea/index.tsx#L27 There's no transformation of the text so it seems like it'd make sense to make it available?
@allforabit I don't know the rules of formik.
Of course @jaywcjlove the request is really to see if the component can be made to act closer to a native component. For instance material ui allows you to use the name
property and it passes the underlying text area event to onChange
handler. It wouldn't just benefit Formik users and would just mean the component would be more standard. I can work on a PR for it if it's of interest?
We provide an onChange
. Welcome to submit PR compatible Formik
.
@allforabit
@allforabit Upgrade @uiw/react-md-editor@3.7.0
Thanks @jaywcjlove @allforabit !
To make this component behave more like a native input element, it should support the
name
attribute. It would make it easier to integrate with form libraries like formik.