mirror of https://github.com/apache/superset.git
feat(editable-title): move and scroll to the end (#15270)
This commit is contained in:
parent
c211f7df8e
commit
f31d573561
|
@ -70,6 +70,13 @@ export default function EditableTitle({
|
|||
useEffect(() => {
|
||||
if (isEditing) {
|
||||
contentRef.current.focus();
|
||||
// move cursor and scroll to the end
|
||||
if (contentRef.current.setSelectionRange) {
|
||||
const { length } = contentRef.current.value;
|
||||
contentRef.current.setSelectionRange(length, length);
|
||||
contentRef.current.scrollLeft = contentRef.current.scrollWidth;
|
||||
contentRef.current.scrollTop = contentRef.current.scrollHeight;
|
||||
}
|
||||
}
|
||||
}, [isEditing]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue