Skip to content

Commit ec3c372

Browse files
committed
feat: Place cursor at the end on first modification. fix #191
1 parent 3c44202 commit ec3c372

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/color-editable-input/src/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ const EditableInput = React.forwardRef<HTMLInputElement, EditableInputProps>((pr
104104
onFocus: () => (isFocus.current = true),
105105
...other,
106106
style: editableStyle,
107+
onFocusCapture: (e) => {
108+
let elm = e.target as HTMLInputElement;
109+
elm.setSelectionRange(elm.value.length, elm.value.length);
110+
},
107111
};
108112
return (
109113
<div className={[prefixCls, className || ''].filter(Boolean).join(' ')} style={wrapperStyle}>

0 commit comments

Comments
 (0)