Skip to content
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

Support name property #286

Closed
simoneb opened this issue Nov 8, 2021 · 8 comments
Closed

Support name property #286

simoneb opened this issue Nov 8, 2021 · 8 comments

Comments

@simoneb
Copy link

simoneb commented Nov 8, 2021

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.

@jaywcjlove
Copy link
Member

<MDEditor
  value={value}
  textareaProps={{
    name: 'field'
  }}
  onChange={setValue}
/>

@simoneb

<MDEditor
  value={value}
+  textareaProps={{
+    name: 'field'
+  }}
  onChange={setValue}
/>

@allforabit
Copy link
Contributor

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?

@allforabit
Copy link
Contributor

Is there a reason that onChange is excluded from textareaProps?

export interface ITextAreaProps
There's no transformation of the text so it seems like it'd make sense to make it available?

@jaywcjlove
Copy link
Member

@allforabit I don't know the rules of formik.

@allforabit
Copy link
Contributor

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?

@jaywcjlove
Copy link
Member

We provide an onChange. Welcome to submit PR compatible Formik.

@allforabit

jaywcjlove added a commit that referenced this issue Nov 12, 2021
@jaywcjlove
Copy link
Member

@allforabit Upgrade @uiw/react-md-editor@3.7.0

@simoneb
Copy link
Author

simoneb commented Nov 12, 2021

Thanks @jaywcjlove @allforabit !

@simoneb simoneb closed this as completed Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants