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