diff --git a/src/mantine-rte/src/components/RichTextEditor/RichTextEditor.tsx b/src/mantine-rte/src/components/RichTextEditor/RichTextEditor.tsx index bda190943dd..a5d6ed2d693 100644 --- a/src/mantine-rte/src/components/RichTextEditor/RichTextEditor.tsx +++ b/src/mantine-rte/src/components/RichTextEditor/RichTextEditor.tsx @@ -43,12 +43,15 @@ function defaultImageUpload(file: File): Promise { export interface RichTextEditorProps extends DefaultProps, - Omit, 'onChange'> { + Omit, 'onChange' | 'defaultValue'> { /** HTML content, value not forced as quill works in uncontrolled mode */ - value: string | Delta; + value?: string | Delta; + + /** Initial value of input */ + defaultValue?: string | Delta; /** Called each time value changes */ - onChange(value: string, delta: Delta, sources: Sources, editor: Editor.UnprivilegedEditor): void; + onChange?(value: string, delta: Delta, sources: Sources, editor: Editor.UnprivilegedEditor): void; /** Called when image image is inserted in editor */ onImageUpload?(image: File): Promise; @@ -94,6 +97,7 @@ export const RichTextEditor = forwardRef( (props: RichTextEditorProps, ref) => { const { value, + defaultValue, onChange, onImageUpload, sticky, @@ -163,6 +167,7 @@ export const RichTextEditor = forwardRef( theme="snow" modules={modules} value={value} + defaultValue={defaultValue} onChange={onChange} ref={mergeRefs(editorRef, ref)} placeholder={placeholder}