fix(notes): reset preview and size after publishing
All checks were successful
Release to Staging / build_and_release (push) Successful in 1m8s
All checks were successful
Release to Staging / build_and_release (push) Successful in 1m8s
This commit is contained in:
parent
7cfd944abf
commit
88725da491
@ -60,6 +60,10 @@ export const NoteSubmit = ({
|
|||||||
})
|
})
|
||||||
}, [content, nsfw, setCache])
|
}, [content, nsfw, setCache])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (ref.current) adjustTextareaHeight(ref.current)
|
||||||
|
}, [content])
|
||||||
|
|
||||||
const [showTryAgainPopup, setShowTryAgainPopup] = useState<boolean>(false)
|
const [showTryAgainPopup, setShowTryAgainPopup] = useState<boolean>(false)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const isTimeout = actionData?.type === 'timeout'
|
const isTimeout = actionData?.type === 'timeout'
|
||||||
@ -85,6 +89,8 @@ export const NoteSubmit = ({
|
|||||||
setContent('')
|
setContent('')
|
||||||
setNsfw(false)
|
setNsfw(false)
|
||||||
|
|
||||||
|
setShowPreview(false)
|
||||||
|
|
||||||
submit(JSON.stringify(formSubmit), {
|
submit(JSON.stringify(formSubmit), {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
encType: 'application/json',
|
encType: 'application/json',
|
||||||
@ -103,10 +109,6 @@ export const NoteSubmit = ({
|
|||||||
// Cancel if not confirmed
|
// Cancel if not confirmed
|
||||||
if (!confirm) return
|
if (!confirm) return
|
||||||
|
|
||||||
// Reset form
|
|
||||||
setContent('')
|
|
||||||
setNsfw(false)
|
|
||||||
|
|
||||||
handleFormSubmit()
|
handleFormSubmit()
|
||||||
},
|
},
|
||||||
[handleFormSubmit]
|
[handleFormSubmit]
|
||||||
@ -115,7 +117,6 @@ export const NoteSubmit = ({
|
|||||||
event: React.ChangeEvent<HTMLTextAreaElement>
|
event: React.ChangeEvent<HTMLTextAreaElement>
|
||||||
) => {
|
) => {
|
||||||
setContent(event.currentTarget.value)
|
setContent(event.currentTarget.value)
|
||||||
adjustTextareaHeight(event.currentTarget)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePreviewToggle = () => {
|
const handlePreviewToggle = () => {
|
||||||
|
@ -7,7 +7,14 @@ import {
|
|||||||
useReplies
|
useReplies
|
||||||
} from 'hooks'
|
} from 'hooks'
|
||||||
import { nip19 } from 'nostr-tools'
|
import { nip19 } from 'nostr-tools'
|
||||||
import { ChangeEvent, useCallback, useEffect, useMemo, useState } from 'react'
|
import {
|
||||||
|
ChangeEvent,
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useRef,
|
||||||
|
useState
|
||||||
|
} from 'react'
|
||||||
import {
|
import {
|
||||||
Link,
|
Link,
|
||||||
useLoaderData,
|
useLoaderData,
|
||||||
@ -96,16 +103,19 @@ export const CommentsPopup = ({ title }: CommentsPopupProps) => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
const ref = useRef<HTMLTextAreaElement>(null)
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||||
const [replyText, setReplyText] = useState('')
|
const [replyText, setReplyText] = useState('')
|
||||||
|
|
||||||
const handleChange = useCallback((e: ChangeEvent<HTMLTextAreaElement>) => {
|
const handleChange = useCallback((e: ChangeEvent<HTMLTextAreaElement>) => {
|
||||||
const value = e.currentTarget.value
|
const value = e.currentTarget.value
|
||||||
setReplyText(value)
|
setReplyText(value)
|
||||||
adjustTextareaHeight(e.currentTarget)
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (ref.current) adjustTextareaHeight(ref.current)
|
||||||
|
}, [replyText])
|
||||||
|
|
||||||
const [visible, setVisible] = useState<CommentEvent[]>([])
|
const [visible, setVisible] = useState<CommentEvent[]>([])
|
||||||
const discoveredCount = commentEvents.length - visible.length
|
const discoveredCount = commentEvents.length - visible.length
|
||||||
const [isLoading, setIsLoading] = useState(true)
|
const [isLoading, setIsLoading] = useState(true)
|
||||||
@ -430,6 +440,7 @@ export const CommentsPopup = ({ title }: CommentsPopupProps) => {
|
|||||||
<div className='pUMCB_CommentToPrime'>
|
<div className='pUMCB_CommentToPrime'>
|
||||||
<div className='IBMSMSMBSSCC_Top'>
|
<div className='IBMSMSMBSSCC_Top'>
|
||||||
<textarea
|
<textarea
|
||||||
|
ref={ref}
|
||||||
className='IBMSMSMBSSCC_Top_Box postSocialTextarea'
|
className='IBMSMSMBSSCC_Top_Box postSocialTextarea'
|
||||||
placeholder='Got something to say?'
|
placeholder='Got something to say?'
|
||||||
value={replyText}
|
value={replyText}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user