Horizontal scrolling to founded keyword

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev committed 2020-11-05 09:29:34 +03:00
1 parent cc8902c32b
commit c3c2e527ee
2 files changed
+12

No files matched your search

@@ -116,7 +116,12 @@ export class PodLogs extends React.Component<Props> {
toOverlay() {
const { activeOverlayLine } = searchStore;
if (!this.virtualListRef.current || activeOverlayLine === undefined) return;
// Scroll vertically
this.virtualListRef.current.scrollToItem(activeOverlayLine, "center");
// Scroll horizontally
const overlay = document.querySelector(".PodLogs .list span.active");
if (!overlay) return;
overlay.scrollIntoViewIfNeeded();
}
/**
+7
View File
@@ -0,0 +1,7 @@
export {}
declare global {
interface Element {
scrollIntoViewIfNeeded(opt_center?: boolean): void;
}
}