fix(web): let long tables flow across exported PDF pages

This commit is contained in:
tianma-if committed 2026-10-22 12:53:02 +08:00
1 parent 573b5a6a41
commit c80645f8f9
2 files changed
+20 -21

No files matched your search

+13 -21
View File
@@ -370,21 +370,18 @@
font-family: var(--editor-body-font-family, var(--edgeever-system-font-family));
}
/* The wrapper is only a scroll frame in the editor. Keeping that box in print
* makes paged.js move the whole table to the next page. */
.edgeever-print-content .tableWrapper {
max-width: 100%;
margin: 1.25rem 0;
overflow: hidden;
border: 1px solid rgb(212 212 212 / 0.7);
border-radius: 6px;
background: #fff;
display: contents;
}
.edgeever-print-content table {
width: 100%;
margin: 1.25rem 0;
border-collapse: separate;
border-spacing: 0;
border-collapse: collapse;
line-height: 1.45;
break-inside: auto;
}
.edgeever-print-content .tableWrapper table {
@@ -393,32 +390,27 @@
.edgeever-print-content thead {
display: table-header-group;
break-inside: auto;
}
.edgeever-print-content tbody {
break-inside: auto;
}
.edgeever-print-content tr {
break-inside: avoid-page;
break-inside: avoid;
}
.edgeever-print-content th,
.edgeever-print-content td {
border: 0;
border-right: 1px solid rgb(229 229 229 / 0.8);
border-bottom: 1px solid rgb(229 229 229 / 0.8);
break-inside: avoid;
border: 1px solid rgb(229 229 229 / 0.8);
padding: 0.48rem 0.8rem;
text-align: left;
vertical-align: top;
overflow-wrap: anywhere;
}
.edgeever-print-content th:last-child,
.edgeever-print-content td:last-child {
border-right: 0;
}
.edgeever-print-content tr:last-child td {
border-bottom: 0;
}
.edgeever-print-content th {
background: rgb(245 245 245 / 0.75);
color: #181818;
+7
View File
@@ -23,4 +23,11 @@ describe("note print page margin", () => {
expect(css).not.toContain("#172033");
expect(css).not.toContain("#0f172a");
});
test("lets a long table continue on the same page", () => {
expect(css).toMatch(/\.edgeever-print-content \.tableWrapper\s*\{[^}]*display:\s*contents;/s);
expect(css).toMatch(/\.edgeever-print-content table\s*\{[^}]*break-inside:\s*auto;/s);
expect(css).toMatch(/\.edgeever-print-content tr\s*\{[^}]*break-inside:\s*avoid;/s);
expect(css).not.toMatch(/\.tableWrapper\s*\{[^}]*overflow:\s*hidden;/s);
});
});