Clear autosave on submit post/market/comment

This commit is contained in:
Sinclair Chen 2022-10-07 19:57:07 -07:00
parent 9736e2d4b4
commit 21b6db3c37
4 changed files with 4 additions and 2 deletions

View File

@ -88,7 +88,7 @@ export function CommentInputTextArea(props: {
const submit = () => { const submit = () => {
submitComment() submitComment()
editor?.commands?.clearContent() editor?.commands?.clearContent(true)
} }
useEffect(() => { useEffect(() => {

View File

@ -46,6 +46,7 @@ export function CreatePost(props: { group?: Group }) {
return e return e
}) })
if (result.post) { if (result.post) {
editor.commands.clearContent(true)
await Router.push(postPath(result.post.slug)) await Router.push(postPath(result.post.slug))
} }
} }

View File

@ -81,7 +81,7 @@ export function useTextEditor(props: {
defaultValue?: Content defaultValue?: Content
disabled?: boolean disabled?: boolean
simple?: boolean simple?: boolean
key?: string // unique key for this text field for autosave key?: string // unique key for autosave. If set, plz call `clearContent(true)` on submit to clear autosave
}) { }) {
const { placeholder, max, defaultValue, disabled, simple, key } = props const { placeholder, max, defaultValue, disabled, simple, key } = props

View File

@ -269,6 +269,7 @@ export function NewContract(props: {
selectedGroup: selectedGroup?.id, selectedGroup: selectedGroup?.id,
isFree: false, isFree: false,
}) })
editor?.commands.clearContent(true)
await router.push(contractPath(result as Contract)) await router.push(contractPath(result as Contract))
} catch (e) { } catch (e) {
console.error('error creating contract', e, (e as any).details) console.error('error creating contract', e, (e as any).details)