如何将Quill(富文本编辑器(与react最终表单集成?
这对我有效
import { FC } from 'react';
import { Field } from 'react-final-form';
import ReactQuill from 'react-quill';
const FormQuill: FC<{ name: string }> = ({ name }) => (
<Field name={name}>
{({ input: { value, ...input } }) => (
<ReactQuill
value={value}
onChange={(newValue, delta, source) => {
if (source === 'user') {
input.onChange(newValue);
}
}}
/>
)}
</Field>
);
export default FormQuill;