fix: pdf table header alignment issue (#2259)

* fix: pdf table header alignment issue
* cleanup

---------

Co-authored-by: Philipinho <16838612+Philipinho@users.noreply.github.com>
This commit is contained in:
Mayank-2-16
2026-06-17 14:32:48 +01:00
committed by GitHub
co-authored by Philipinho
parent 2ff8720832
commit 1867aa8bf6
3 changed files with 17 additions and 5 deletions
@@ -58,6 +58,7 @@ export default function PdfRenderPage() {
title={data.title} title={data.title}
content={data.content} content={data.content}
pageId={data.pageId} pageId={data.pageId}
printMode
/> />
</Container> </Container>
); );
@@ -15,6 +15,7 @@ interface PageEditorProps {
title: string; title: string;
content: any; content: any;
pageId?: string; pageId?: string;
printMode?: boolean;
/** /**
* When rendering inside a public share, pass the share's id (or key). Lookups * When rendering inside a public share, pass the share's id (or key). Lookups
* for transclusion content then resolve against the share graph instead of * for transclusion content then resolve against the share graph instead of
@@ -28,6 +29,7 @@ export default function ReadonlyPageEditor({
title, title,
content, content,
pageId, pageId,
printMode = false,
shareId, shareId,
}: PageEditorProps) { }: PageEditorProps) {
const [, setReadOnlyEditor] = useAtom(readOnlyEditorAtom); const [, setReadOnlyEditor] = useAtom(readOnlyEditorAtom);
@@ -48,8 +50,12 @@ export default function ReadonlyPageEditor({
}, []); }, []);
const extensions = useMemo(() => { const extensions = useMemo(() => {
const excludedExtensions = new Set([
"uniqueID",
...(printMode ? ["tableHeaderPin", "tableReadonlySort"] : []),
]);
const filteredExtensions = mainExtensions.filter( const filteredExtensions = mainExtensions.filter(
(ext) => ext.name !== "uniqueID", (ext) => !excludedExtensions.has(ext.name),
); );
return [ return [
@@ -59,7 +65,7 @@ export default function ReadonlyPageEditor({
updateDocument: false, updateDocument: false,
}), }),
]; ];
}, []); }, [printMode]);
const titleExtensions = [ const titleExtensions = [
Document.extend({ Document.extend({
@@ -163,8 +163,13 @@
@media print { @media print {
.tableWrapper.tableHeaderPinned table tr:first-child { .tableWrapper.tableHeaderPinned table tr:first-child {
position: static; position: static !important;
transform: none; top: auto !important;
transform: none !important;
}
.tableReadonlySortChevron {
display: none !important;
} }
} }
@@ -268,4 +273,4 @@
.prosemirror-dropcursor-inline { .prosemirror-dropcursor-inline {
display: none; display: none;
} }
} }