This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new f31d573 feat(editable-title): move and scroll to the end (#15270)
f31d573 is described below
commit f31d573561824043521b5081aea42620d6ac4558
Author: Yaozong Liu <[email protected]>
AuthorDate: Wed Jun 23 13:01:14 2021 +0800
feat(editable-title): move and scroll to the end (#15270)
---
superset-frontend/src/components/EditableTitle/index.tsx | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/superset-frontend/src/components/EditableTitle/index.tsx
b/superset-frontend/src/components/EditableTitle/index.tsx
index ec2245b..86c0350 100644
--- a/superset-frontend/src/components/EditableTitle/index.tsx
+++ b/superset-frontend/src/components/EditableTitle/index.tsx
@@ -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]);