mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix log search
- Don't blur on enter by default on <SearchInput> - Use SHIFT+ENTER for reverse search jumping Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
2ca2793bfc
commit
fd9e2ba8ae
@ -52,7 +52,11 @@ export const LogSearch = observer(({ onSearch, scrollToOverlay, model: { logTabD
|
|||||||
|
|
||||||
const onKeyDown = (evt: React.KeyboardEvent<any>) => {
|
const onKeyDown = (evt: React.KeyboardEvent<any>) => {
|
||||||
if (evt.key === "Enter") {
|
if (evt.key === "Enter") {
|
||||||
onNextOverlay();
|
if (evt.shiftKey) {
|
||||||
|
onPrevOverlay();
|
||||||
|
} else {
|
||||||
|
onNextOverlay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -50,13 +50,9 @@ export class SearchInput extends React.Component<Props> {
|
|||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
onKeyDown(evt: React.KeyboardEvent<any>) {
|
onKeyDown(evt: React.KeyboardEvent<any>) {
|
||||||
if (this.props.onKeyDown) {
|
this.props.onKeyDown?.(evt);
|
||||||
this.props.onKeyDown(evt);
|
|
||||||
}
|
|
||||||
// clear on escape-key
|
|
||||||
const escapeKey = evt.nativeEvent.code === "Escape";
|
|
||||||
|
|
||||||
if (escapeKey) {
|
if (evt.nativeEvent.code === "Escape") {
|
||||||
this.clear();
|
this.clear();
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
}
|
}
|
||||||
@ -87,6 +83,7 @@ export class SearchInput extends React.Component<Props> {
|
|||||||
onKeyDown={this.onKeyDown}
|
onKeyDown={this.onKeyDown}
|
||||||
iconRight={rightIcon}
|
iconRight={rightIcon}
|
||||||
ref={this.inputRef}
|
ref={this.inputRef}
|
||||||
|
blurOnEnter={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user