comment draft saving
This commit is contained in:
parent
e42f1d6bb9
commit
b6a530f5c4
|
@ -17,7 +17,7 @@ export function CommentsHeader ({ handleSort }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Navbar className='py-0'>
|
<Navbar className='py-1'>
|
||||||
<Nav
|
<Nav
|
||||||
className={styles.navbarNav}
|
className={styles.navbarNav}
|
||||||
activeKey={sort}
|
activeKey={sort}
|
||||||
|
|
|
@ -237,7 +237,6 @@ export function Form ({
|
||||||
onSubmit={async (...args) =>
|
onSubmit={async (...args) =>
|
||||||
onSubmit && onSubmit(...args).then(() => {
|
onSubmit && onSubmit(...args).then(() => {
|
||||||
if (!storageKeyPrefix) return
|
if (!storageKeyPrefix) return
|
||||||
console.log(...args)
|
|
||||||
Object.keys(...args).forEach(v =>
|
Object.keys(...args).forEach(v =>
|
||||||
localStorage.removeItem(storageKeyPrefix + '-' + v))
|
localStorage.removeItem(storageKeyPrefix + '-' + v))
|
||||||
}).catch(e => setError(e.message || e))}
|
}).catch(e => setError(e.message || e))}
|
||||||
|
|
|
@ -13,7 +13,7 @@ export const CommentSchema = Yup.object({
|
||||||
})
|
})
|
||||||
|
|
||||||
export default function Reply ({ parentId, onSuccess, replyOpen }) {
|
export default function Reply ({ parentId, onSuccess, replyOpen }) {
|
||||||
const [reply, setReply] = useState(replyOpen)
|
const [reply, setReply] = useState(replyOpen || !!localStorage.getItem('reply-' + parentId + '-' + 'text'))
|
||||||
const me = useMe()
|
const me = useMe()
|
||||||
|
|
||||||
const [createComment] = useMutation(
|
const [createComment] = useMutation(
|
||||||
|
@ -73,6 +73,7 @@ export default function Reply ({ parentId, onSuccess, replyOpen }) {
|
||||||
resetForm({ text: '' })
|
resetForm({ text: '' })
|
||||||
setReply(replyOpen || false)
|
setReply(replyOpen || false)
|
||||||
}}
|
}}
|
||||||
|
storageKeyPrefix={'reply-' + parentId}
|
||||||
>
|
>
|
||||||
<MarkdownInput
|
<MarkdownInput
|
||||||
name='text'
|
name='text'
|
||||||
|
|
Loading…
Reference in New Issue