jodit / jodit-react

React wrapper for Jodit
MIT License
354 stars 118 forks source link

Error schema validation with Yup #227

Open Lefevcal opened 1 year ago

Lefevcal commented 1 year ago

Hello, I have an error when i tried to validate a form with yup which has a jodit textarea input.

I use react-hook-form for forms. This is my form for a mail with validation : image

This is my textarea input component: image <JoditEditor ref={fieldRef} value={content} config={config} onBlur={(newContent) => setContent(newContent)} /> where content is the value of the input named body of my form

And my error is: image

I tried to set up the validation in the onSubmit function but I have the same error when I tried to make: form.setError('body', { type: 'custom', message: 'error'})

To overcome this problem I add a field in the form to make the validation but I don't like this method and I would like to have your opinions.

Thanks for advance !