fix: remirror image not updating (#294)
This commit is contained in:
parent
1665863bd9
commit
4b068398bd
3 changed files with 25 additions and 37 deletions
|
|
@ -49,7 +49,7 @@ const defaultValues: Partial<IIssue> = {
|
|||
};
|
||||
|
||||
export interface IssueFormProps {
|
||||
handleFormSubmit: (values: Partial<IIssue>) => void;
|
||||
handleFormSubmit: (values: Partial<IIssue>) => Promise<void>;
|
||||
initialData?: Partial<IIssue>;
|
||||
issues: IIssue[];
|
||||
projectId: string;
|
||||
|
|
@ -107,17 +107,18 @@ export const IssueForm: FC<IssueFormProps> = ({
|
|||
reset({
|
||||
...defaultValues,
|
||||
project: projectId,
|
||||
description: "",
|
||||
description_html: "<p></p>",
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
reset({
|
||||
...defaultValues,
|
||||
...watch(),
|
||||
project: projectId,
|
||||
...initialData,
|
||||
project: projectId,
|
||||
});
|
||||
}, [initialData, reset, watch, projectId]);
|
||||
}, [initialData, reset, projectId]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -238,13 +239,11 @@ export const IssueForm: FC<IssueFormProps> = ({
|
|||
<Controller
|
||||
name="description"
|
||||
control={control}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
render={({ field: { value } }) => (
|
||||
<RemirrorRichTextEditor
|
||||
value={value}
|
||||
onBlur={(jsonValue, htmlValue) => {
|
||||
setValue("description", jsonValue);
|
||||
setValue("description_html", htmlValue);
|
||||
}}
|
||||
onJSONChange={(jsonValue) => setValue("description", jsonValue)}
|
||||
onHTMLChange={(htmlValue) => setValue("description_html", htmlValue)}
|
||||
placeholder="Enter Your Text..."
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue