feat(notebook): fold cells and outputs in the notebook editor (#5650)

A chevron in each cell toolbar folds the cell to one line (its first non-blank line, or a Markdown heading's text) with its output count; clicking the line unfolds it. Code cells with outputs get Hide Output / Show Output, which folds only the outputs, and the notebook toolbar gets Collapse All Cells / Expand All Cells. Fold state is view state on NotebookSession; the .ipynb file is not modified. The singular output counts use their own catalog keys so they don't collide with the run output pane's "{name} output".

Co-authored-by: Delaruno20 <[email protected]>
Цей коміт міститься в:
Delaruno20таDelaruno20 authored and GitHub committed 2026-11-25 08:46:07 +08:00
1 джерело f6e51d9214
коміт 7d4c58a0f1
7 files changed
+206 -2

No files matched your search

+48
Переглянути файл
@@ -109,6 +109,54 @@
.cellEditor {
min-height: 48px;
}
.collapsedCell,
.hiddenOutputs {
display: flex;
align-items: baseline;
gap: var(--space-3);
width: 100%;
margin: 0;
border: 0;
background: none;
color: var(--fg-muted);
text-align: left;
cursor: pointer;
}
.collapsedCell {
padding: 6px 12px;
font: var(--openidea-editor-font-size, var(--fs-code)) / var(--openidea-editor-line-height, var(--lh-code, 1.5))
var(--font-mono);
}
.collapsedMarkdown {
font: 600 var(--markdown-preview-font-size, var(--fs-ui)) var(--font-ui);
}
.collapsedText {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--fg);
}
.collapsedOutputs {
flex: none;
margin-left: auto;
font: var(--fs-small) var(--font-ui);
}
.hiddenOutputs {
border-top: 1px solid var(--border);
padding: 4px 12px;
font-size: var(--fs-small);
font-style: italic;
}
.collapsedCell:hover,
.hiddenOutputs:hover {
background: var(--bg-hover);
}
.collapsedCell:focus-visible,
.hiddenOutputs:focus-visible {
outline: 2px solid var(--accent);
outline-offset: -2px;
}
.outputs {
border-top: 1px solid var(--border);
padding: 8px 12px;