mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
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(() => {
|
useEffect(() => {
|
||||||
if (isEditing) {
|
if (isEditing) {
|
||||||
contentRef.current.focus();
|
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]);
|
}, [isEditing]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user