Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fixes #4182 - Highlight entire word when editing title
Browse files Browse the repository at this point in the history
  • Loading branch information
punamdahiya committed Mar 23, 2018
1 parent 77fa083 commit 86b0fd6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/src/pages/shot/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ class EditableTitle extends React.Component {
className="shot-title-input"
style={{minWidth: this.state.minWidth}}
type="text" defaultValue={this.props.title} autoFocus="true"
onBlur={this.onExit.bind(this)} onKeyUp={this.onKeyUp.bind(this)} />
onBlur={this.onExit.bind(this)} onKeyUp={this.onKeyUp.bind(this)} onFocus={this.onFocus} />
</form>;
}

Expand All @@ -714,6 +714,10 @@ class EditableTitle extends React.Component {
this.setState({isEditing: false, isSaving: val});
}

onFocus(event) {
event.target.select();
}

onKeyUp(event) {
if ((event.key || event.code) === "Escape") {
this.setState({isEditing: false});
Expand Down

0 comments on commit 86b0fd6

Please sign in to comment.