fix: Uncollapse code when printing (#12193)

closes #12192
This commit is contained in:
Tom Moor
2026-04-27 22:55:16 -04:00
committed by GitHub
parent c34567cb0a
commit af77bd6474
2 changed files with 20 additions and 2 deletions
+19
View File
@@ -1893,6 +1893,8 @@ mark {
}
&::after {
max-height: calc(10 * 1.4em + 0.75em);
overflow: hidden;
clip-path: inset(0 0 calc(100% - 10 * 1.4em - 0.75em) 0);
}
@@ -1913,6 +1915,23 @@ mark {
${props.theme.codeBackground} 100%
);
}
@media print {
pre {
max-height: none;
overflow: visible;
}
&::after {
max-height: none;
overflow: visible;
clip-path: none;
}
&::before {
display: none;
}
}
}
.${EditorStyleHelper.codeBlockToggle} {
+1 -2
View File
@@ -107,9 +107,8 @@ function buildCollapseState(
if (isCollapsed) {
const totalLines = (node.textContent.match(/\n/g)?.length ?? 0) + 1;
const cappedLines = Math.min(totalLines, COLLAPSE_LINE_THRESHOLD);
const gutterWidth = String(totalLines).length;
const lineNumberText = Array.from({ length: cappedLines }, (_, i) =>
const lineNumberText = Array.from({ length: totalLines }, (_, i) =>
String(i + 1).padStart(gutterWidth, " ")
).join("\n");