-
-
Save AubreyHewes/b1c5e8abde44e6ec01520c7a67e0de2e to your computer and use it in GitHub Desktop.
How to use React Quill inside Redux Forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Field } from 'redux-form'; | |
import ReactQuill from 'react-quill'; | |
function renderQuill({ input }) { | |
return ( | |
<ReactQuill | |
{...input} | |
onChange={(newValue, delta, source) => { | |
if (source === 'user') { | |
input.onChange(newValue); | |
} | |
}} | |
onBlur={(range, source, quill) => { | |
input.onBlur(quill.getHTML()); | |
}} | |
/> | |
); | |
} | |
// Usage: | |
<Field name="description" component={renderQuill} />; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment