#RichTextEditor defaultValue

2 messages · Page 1 of 1 (latest)

untold lance
#

Is it possible to combine use-form with RichTextEditor? For example:

// My component
<TextEditor 
    label={field.label}
    required={field.required}
    id={field.id}
    {...form.getInputProps(field.id)}
    form={form}
/>

Inside TextEditor :

const editor = useEditor({
    extensions: [ ... ],
    content: props.value,
    onUpdate: ({ editor }) => {
        props.onChange(editor.getHTML());
    }, 
});

...

<RichTextEditor editor={editor} labels={{ ...RichTextEditorLabels_RU }}>
  ...
</RichTextEditor>

But useEditor doesn't have default values that initialValues (from use-from) sets. I want to save the user's input so that it can be restored when they reload the page. How to achieve this?

simple mauve