mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-20 22:23:53 +08:00
Update OutlineViewItem to focus end of input when editing
This commit is contained in:
parent
bf2cebc08f
commit
8b0a3a69db
3 changed files with 8 additions and 0 deletions
|
@ -42,6 +42,7 @@ onDeleteItem = (item) ->
|
|||
Actions.queueTask(new DestroyCategoryTask({category}))
|
||||
|
||||
onEditItem = (item, value) ->
|
||||
return unless value
|
||||
return if item.deleted is true
|
||||
category = item.perspective.category()
|
||||
return unless category
|
||||
|
|
|
@ -139,6 +139,7 @@ class SidebarSection
|
|||
collapsed: collapsed
|
||||
onToggleCollapsed: onToggleCollapsed
|
||||
onItemCreated: (displayName) ->
|
||||
return unless displayName
|
||||
category = new Category
|
||||
displayName: displayName
|
||||
accountId: account.id
|
||||
|
|
|
@ -130,6 +130,11 @@ class OutlineViewItem extends Component {
|
|||
this.setState({editing: true});
|
||||
}
|
||||
|
||||
_onInputFocus = (event)=> {
|
||||
const input = event.target;
|
||||
input.selectionStart = input.selectionEnd = input.value.length;
|
||||
}
|
||||
|
||||
_onInputBlur = (event)=> {
|
||||
this._clearEditingState(event);
|
||||
}
|
||||
|
@ -202,6 +207,7 @@ class OutlineViewItem extends Component {
|
|||
placeholder={placeholder}
|
||||
defaultValue={item.name}
|
||||
onBlur={this._onInputBlur}
|
||||
onFocus={this._onInputFocus}
|
||||
onKeyDown={this._onInputKeyDown} />
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue