mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Horizontal scrolling to founded keyword
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
cc8902c32b
commit
c3c2e527ee
@ -116,7 +116,12 @@ export class PodLogs extends React.Component<Props> {
|
|||||||
toOverlay() {
|
toOverlay() {
|
||||||
const { activeOverlayLine } = searchStore;
|
const { activeOverlayLine } = searchStore;
|
||||||
if (!this.virtualListRef.current || activeOverlayLine === undefined) return;
|
if (!this.virtualListRef.current || activeOverlayLine === undefined) return;
|
||||||
|
// Scroll vertically
|
||||||
this.virtualListRef.current.scrollToItem(activeOverlayLine, "center");
|
this.virtualListRef.current.scrollToItem(activeOverlayLine, "center");
|
||||||
|
// Scroll horizontally
|
||||||
|
const overlay = document.querySelector(".PodLogs .list span.active");
|
||||||
|
if (!overlay) return;
|
||||||
|
overlay.scrollIntoViewIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
7
types/dom.d.ts
vendored
Normal file
7
types/dom.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export {}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Element {
|
||||||
|
scrollIntoViewIfNeeded(opt_center?: boolean): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user