Skip to content

Commit

Permalink
Use same draft for modal editor
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Mar 18, 2024
1 parent 93fa011 commit 45071de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/posts/editor/ModalEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const PostEditorModalBody = ({
const [spaceId, setSpaceId] = useState<string>(defaultSpace)

const { loading } = useFetchSpaces({ ids: spaceIds, dataSource: DataSourceTypes.SQUID })
const { saveContent } = useAutoSaveFromForm({ entity: 'post' })
const { savedData, saveContent } = useAutoSaveFromForm({ entity: 'post' })

useEffect(() => {
setSpaceId(defaultSpace)
Expand Down Expand Up @@ -201,7 +201,7 @@ export const PostEditorModalBody = ({
)

return (
<Form form={form} className='my-0' onFieldsChange={() => saveDraft()}>
<Form form={form} className='my-0' initialValues={savedData} onFieldsChange={() => saveDraft()}>
<SpaceSelector />
<Form.Item name={fieldName('body')} className='my-3'>
{/* value and onChange are provided by Form.Item */}
Expand Down

0 comments on commit 45071de

Please sign in to comment.