Select search text on focus (#1201)
This commit is contained in:
parent
ebc829cef0
commit
1fd08af136
|
@ -27,6 +27,10 @@ export default Vue.extend({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
selectOnFocus: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
@ -130,6 +134,13 @@ export default Vue.extend({
|
||||||
|
|
||||||
handleInputBlur: function () {
|
handleInputBlur: function () {
|
||||||
if (!this.searchState.isPointerInList) { this.searchState.showOptions = false }
|
if (!this.searchState.isPointerInList) { this.searchState.showOptions = false }
|
||||||
|
},
|
||||||
|
|
||||||
|
handleFocus: function(e) {
|
||||||
|
this.searchState.showOptions = true
|
||||||
|
if (this.selectOnFocus) {
|
||||||
|
e.target.select()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
@input="e => handleInput(e.target.value)"
|
@input="e => handleInput(e.target.value)"
|
||||||
@focus="searchState.showOptions = true"
|
@focus="handleFocus"
|
||||||
@blur="handleInputBlur"
|
@blur="handleInputBlur"
|
||||||
@keydown="e => handleKeyDown(e.keyCode)"
|
@keydown="e => handleKeyDown(e.keyCode)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
:placeholder="$t('Search / Go to URL')"
|
:placeholder="$t('Search / Go to URL')"
|
||||||
class="searchInput"
|
class="searchInput"
|
||||||
:is-search="true"
|
:is-search="true"
|
||||||
|
:select-on-focus="true"
|
||||||
:data-list="searchSuggestionsDataList"
|
:data-list="searchSuggestionsDataList"
|
||||||
@input="getSearchSuggestionsDebounce"
|
@input="getSearchSuggestionsDebounce"
|
||||||
@click="goToSearch"
|
@click="goToSearch"
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
</div>
|
</div>
|
||||||
<ft-input
|
<ft-input
|
||||||
:placeholder="$t('Channel.Search Channel')"
|
:placeholder="$t('Channel.Search Channel')"
|
||||||
|
:select-on-focus="true"
|
||||||
class="channelSearch"
|
class="channelSearch"
|
||||||
@click="newSearch"
|
@click="newSearch"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue