Place cursor at end when entering cell (#3743)
#3723 #3724 place cursor at end when entering cell
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import { ChangeEvent, useRef, useState } from 'react';
|
import { ChangeEvent, useEffect, useRef, useState } from 'react';
|
||||||
import TextareaAutosize from 'react-textarea-autosize';
|
import TextareaAutosize from 'react-textarea-autosize';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
@ -54,6 +54,15 @@ export const TextAreaInput = ({
|
|||||||
|
|
||||||
const wrapperRef = useRef<HTMLTextAreaElement>(null);
|
const wrapperRef = useRef<HTMLTextAreaElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (wrapperRef.current) {
|
||||||
|
wrapperRef.current.setSelectionRange(
|
||||||
|
wrapperRef.current.value.length,
|
||||||
|
wrapperRef.current.value.length,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
useRegisterInputEvents({
|
useRegisterInputEvents({
|
||||||
inputRef: wrapperRef,
|
inputRef: wrapperRef,
|
||||||
inputValue: internalText,
|
inputValue: internalText,
|
||||||
|
|||||||
Reference in New Issue
Block a user