1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-15 09:04:04 +02:00

More note searchbar enhancements.

Indicate selected match
Fade search result text
Ctrl-F selects input content upon repeat
This commit is contained in:
mic074b 2020-01-21 20:06:28 +11:00
parent 1faac68441
commit f661cad6a3
2 changed files with 11 additions and 3 deletions

View File

@ -87,6 +87,13 @@ class NoteSearchBarComponent extends React.Component {
if (this.props.onClose) this.props.onClose(); if (this.props.onClose) this.props.onClose();
} }
if (event.keyCode === 70) {
// F key
if (event.ctrlKey) {
event.target.select();
}
}
} }
previousButton_click() { previousButton_click() {
@ -114,9 +121,9 @@ class NoteSearchBarComponent extends React.Component {
return _('No matches found'); return _('No matches found');
} }
if (this.props.resultCount === 1) { if (this.props.resultCount === 1) {
return _('%d match found', this.props.resultCount); return _('1 of 1 match');
} }
return _('%d matches found', this.props.resultCount); return _('%d of %d matches', this.props.selectedIndex + 1, this.props.resultCount);
} }
render() { render() {
@ -136,7 +143,7 @@ class NoteSearchBarComponent extends React.Component {
const textStyle = Object.assign({ const textStyle = Object.assign({
fontSize: theme.fontSize, fontSize: theme.fontSize,
fontFamily: theme.fontFamily, fontFamily: theme.fontFamily,
color: theme.color, color: theme.colorFaded,
backgroundColor: theme.backgroundColor, backgroundColor: theme.backgroundColor,
}); });
const matchesFoundString = (this.props.query.length > 0) ? ( const matchesFoundString = (this.props.query.length > 0) ? (

View File

@ -2157,6 +2157,7 @@ class NoteTextComponent extends React.Component {
}} }}
query={this.state.localSearch.result.query} query={this.state.localSearch.result.query}
resultCount={this.state.localSearch.result.count} resultCount={this.state.localSearch.result.count}
selectedIndex={this.state.localSearch.selectedIndex}
onChange={this.noteSearchBar_change} onChange={this.noteSearchBar_change}
onNext={this.noteSearchBar_next} onNext={this.noteSearchBar_next}
onPrevious={this.noteSearchBar_previous} onPrevious={this.noteSearchBar_previous}