Skip to content

Instantly share code, notes, and snippets.

@AubreyHewes
Forked from Gaya/redux-form-react-quill.jsx
Created November 10, 2017 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AubreyHewes/b1c5e8abde44e6ec01520c7a67e0de2e to your computer and use it in GitHub Desktop.
Save AubreyHewes/b1c5e8abde44e6ec01520c7a67e0de2e to your computer and use it in GitHub Desktop.
How to use React Quill inside Redux Forms
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