File tree Expand file tree Collapse file tree 5 files changed +26
-15
lines changed Expand file tree Collapse file tree 5 files changed +26
-15
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,13 @@ body[dir='rtl'] .ft-input-component.search.showClearTextButton:focus-within .inp
31
31
padding-inline-start : 46px ;
32
32
}
33
33
34
- .ft-input-component : focus-within .clearInputTextButton {
34
+ .ft-input-component : focus-within .clearInputTextButton ,
35
+ .ft-input-component .showOptions .clearInputTextButton {
35
36
opacity : 0.5 ;
36
37
}
37
38
38
- .clearTextButtonVisible .clearInputTextButton .visible ,
39
- .ft-input-component : focus-within .clearInputTextButton .visible {
39
+ .clearTextButtonVisible : not (. showOptions ) .clearInputTextButton .visible ,
40
+ .ft-input-component : focus-within : not (. showOptions ) .clearInputTextButton .visible {
40
41
cursor : pointer;
41
42
opacity : 1 ;
42
43
}
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ export default defineComponent({
96
96
}
97
97
} ,
98
98
computed : {
99
+ showOptions : function ( ) {
100
+ return ( this . inputData !== '' || this . showDataWhenEmpty ) && this . visibleDataList . length > 0 && this . searchState . showOptions
101
+ } ,
102
+
99
103
barColor : function ( ) {
100
104
return this . $store . getters . getBarColor
101
105
} ,
@@ -313,7 +317,7 @@ export default defineComponent({
313
317
// Reset selected option before it's updated
314
318
this . searchState . selectedOption = - 1
315
319
this . searchState . keyboardSelectedOptionIndex = - 1
316
- if ( this . inputData === '' ) {
320
+ if ( this . inputData . trim ( ) === '' ) {
317
321
this . visibleDataList = this . dataList
318
322
return
319
323
}
Original file line number Diff line number Diff line change 7
7
forceTextColor: forceTextColor,
8
8
showActionButton: showActionButton,
9
9
showClearTextButton: showClearTextButton,
10
- clearTextButtonVisible: inputDataPresent,
10
+ clearTextButtonVisible: inputDataPresent || showOptions,
11
+ showOptions: showOptions,
11
12
disabled: disabled
12
13
}"
13
14
>
29
30
:icon =" ['fas', 'times-circle']"
30
31
class =" clearInputTextButton"
31
32
:class =" {
32
- visible: inputDataPresent
33
+ visible: inputDataPresent || showOptions
33
34
}"
34
35
tabindex =" 0"
35
36
role =" button"
68
69
</span >
69
70
<div class =" options" >
70
71
<ul
71
- v-if =" (inputData !== '' || showDataWhenEmpty) && visibleDataList.length > 0 && searchState. showOptions"
72
+ v-if =" showOptions"
72
73
class =" list"
73
74
@mouseenter =" searchState.isPointerInList = true"
74
75
@mouseleave =" searchState.isPointerInList = false"
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ export default defineComponent({
127
127
if ( ! this . enableSearchSuggestions ) {
128
128
return
129
129
}
130
- return this . lastSuggestionQuery === '' ? this . $store . getters . getLatestUniqueSearchHistoryEntries ( this . $router . currentRoute . fullPath ) : this . searchSuggestionsDataList
130
+ return this . lastSuggestionQuery === '' ? this . $store . getters . getLatestUniqueSearchHistoryEntries : this . searchSuggestionsDataList
131
131
} ,
132
132
} ,
133
133
watch : {
@@ -180,11 +180,16 @@ export default defineComponent({
180
180
181
181
if ( isFreeTubeInternalQuery ) {
182
182
const adjustedQuery = queryText . substring ( 3 )
183
- openInternalPath ( {
184
- path : adjustedQuery ,
185
- adjustedQuery,
186
- doCreateNewWindow
187
- } )
183
+ if ( this . $router . currentRoute . fullPath !== adjustedQuery ) {
184
+ openInternalPath ( {
185
+ path : adjustedQuery ,
186
+ adjustedQuery,
187
+ doCreateNewWindow
188
+ } )
189
+ }
190
+
191
+ // update in-use search query to the selected search history entry name
192
+ this . lastSuggestionQuery = this . $store . getters . getSearchHistoryEntryWithRoute ( adjustedQuery ) ?. name ?? ''
188
193
return
189
194
}
190
195
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ const getters = {
12
12
return state . searchHistoryEntries
13
13
} ,
14
14
15
- getLatestUniqueSearchHistoryEntries : ( state ) => ( routeToExclude ) => {
15
+ getLatestUniqueSearchHistoryEntries : ( state ) => {
16
16
const nameSet = new Set ( )
17
17
return state . searchHistoryEntries . filter ( ( entry ) => {
18
- if ( nameSet . has ( entry . name ) || routeToExclude === entry . route ) {
18
+ if ( nameSet . has ( entry . name ) ) {
19
19
return false
20
20
}
21
21
You can’t perform that action at this time.
0 commit comments