Skip to content

Commit

Permalink
virtualize pages / section
Browse files Browse the repository at this point in the history
  • Loading branch information
bigabig committed Feb 11, 2024
1 parent 41ee952 commit 635d914
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions frontend/src/features/DocumentRenderer/DocumentRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function DocumentRenderer({
content = content.substring(0, content.length - 6);
}
content = content.trim();
const regex = /<page num="\d+">|<\/page><page num="\d+">|<\/page>/gm;
const regex = /<section pagenum="\d+">|<\/section><section pagenum="\d+">|<\/section>/gm;
let splitted = content.split(regex);
splitted = splitted.filter((s) => s.length > 0);
return splitted;
Expand All @@ -56,7 +56,6 @@ function DocumentRenderer({
count: numPages,
getScrollElement: () => listRef.current,
estimateSize: () => 155,
overscan: 1,
});

// Order matters. Instructions are processed in
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/views/search/DocumentViewer/DocumentViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ function DocumentViewer({

return (
<Card raised {...props}>
<CardContent>
<Stack spacing={2}>
<CardContent className="h100">
<Stack spacing={2} className="h100">
<div style={{ display: "flex", alignItems: "center" }}>
<EditableDocumentName
sdocId={sdocId}
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/views/search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,14 @@ function Search() {
</Grid>
)}
{(isSplitView || viewDocument) && (
<Grid item md={isSplitView ? 6 : 12} className="h100" overflow={"auto"}>
<Container sx={{ my: 2, height: "fit-content" }}>
<Grid item md={isSplitView ? 6 : 12} className="h100">
<Container className="h100" sx={{ py: 2 }}>
<DocumentViewer
sdocId={sdocId ? parseInt(sdocId) : undefined}
handleTagClick={handleAddTagFilter}
showEntities={isShowEntities}
isIdleContent={<Typography>Click a document to read it :)</Typography>}
className="h100"
/>
</Container>
</Grid>
Expand Down

0 comments on commit 635d914

Please sign in to comment.