mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(reply modal): cursor would move to end of text while replying
This commit is contained in:
@@ -86,11 +86,16 @@ const ReplyModal = ({ closeModal, parentCid, scrollY }: ReplyModalProps) => {
|
|||||||
if (ref) {
|
if (ref) {
|
||||||
textRef.current = ref;
|
textRef.current = ref;
|
||||||
!isMobile && ref.focus();
|
!isMobile && ref.focus();
|
||||||
const len = ref.value.length;
|
|
||||||
ref.setSelectionRange(len, len);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (textRef.current) {
|
||||||
|
const len = textRef.current.value.length;
|
||||||
|
textRef.current.setSelectionRange(len, len);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
const contentPrefix = `c/${parentCid && Plebbit.getShortCid(parentCid)}\n`;
|
const contentPrefix = `c/${parentCid && Plebbit.getShortCid(parentCid)}\n`;
|
||||||
|
|
||||||
const handleContentInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
const handleContentInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user