Bug 1617237 - Part 4: Select all text when URL input is focused r=daisuke

Depends on D72227

Differential Revision: https://phabricator.services.mozilla.com/D72274
This commit is contained in:
Micah Tigley 2020-05-07 15:19:36 +00:00
Родитель 65cbd5305b
Коммит fe40cdd7f1
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -42,6 +42,7 @@ class DebugTargetInfo extends PureComponent {
this.state = { urlValue: props.toolbox.target.url }; this.state = { urlValue: props.toolbox.target.url };
this.onChange = this.onChange.bind(this); this.onChange = this.onChange.bind(this);
this.onFocus = this.onFocus.bind(this);
this.onSubmit = this.onSubmit.bind(this); this.onSubmit = this.onSubmit.bind(this);
} }
@ -150,6 +151,10 @@ class DebugTargetInfo extends PureComponent {
this.setState({ urlValue: target.value }); this.setState({ urlValue: target.value });
} }
onFocus({ target }) {
target.select();
}
onSubmit(event) { onSubmit(event) {
event.preventDefault(); event.preventDefault();
let url = this.state.urlValue; let url = this.state.urlValue;
@ -253,6 +258,7 @@ class DebugTargetInfo extends PureComponent {
dom.input({ dom.input({
className: "devtools-textinput debug-target-url-input", className: "devtools-textinput debug-target-url-input",
onChange: this.onChange, onChange: this.onChange,
onFocus: this.onFocus,
defaultValue: url, defaultValue: url,
}) })
); );