Файли
openidea/src/features/notebook/Notebook.module.css
T
Delaruno20таDelaruno20 7d4c58a0f1 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]>
2026-11-25 08:46:07 +08:00

271 рядки
4.9 KiB
CSS

.root {
display: flex;
flex: 1;
flex-direction: column;
min-height: 0;
min-width: 0;
background: var(--bg-editor, var(--bg-app));
color: var(--fg);
outline: none;
}
.toolbar {
display: flex;
flex: none;
align-items: center;
flex-wrap: wrap;
gap: 3px;
min-height: 36px;
padding: 4px 8px;
border-bottom: 1px solid var(--border-editor-tabs, var(--border));
font-size: var(--fs-small);
}
.separator {
width: 1px;
height: 16px;
margin: 0 4px;
background: var(--border);
}
.spacer {
flex: 1;
}
.interpreter {
min-width: 120px;
max-width: 260px;
}
.kernel {
display: inline-flex;
align-items: center;
gap: 5px;
padding: 0 6px;
color: var(--fg-muted);
}
.error {
display: flex;
align-items: flex-start;
gap: var(--space-3);
padding: 8px 12px;
color: var(--danger, var(--fg));
border-bottom: 1px solid var(--border);
overflow-wrap: anywhere;
user-select: text;
}
.errorMessage {
flex: 1;
min-width: 0;
white-space: pre-wrap;
}
.errorMessage pre {
max-height: 200px;
overflow: auto;
}
.kernelHelp {
display: block;
margin-top: 6px;
}
.scroll {
flex: 1;
min-height: 0;
min-width: 0;
overflow: auto;
overflow-anchor: none;
}
.cellList {
position: relative;
width: 100%;
}
.virtualCell {
position: absolute;
top: 0;
left: 0;
width: 100%;
padding: 6px 12px;
box-sizing: border-box;
}
.cell {
border: 1px solid var(--border);
border-radius: var(--radius-small, 4px);
min-width: 0;
overflow: hidden;
}
.selected {
border-color: var(--accent);
}
.cellToolbar {
display: flex;
align-items: center;
gap: var(--space-0-5);
min-height: 28px;
padding: 2px 6px;
background: var(--bg-elev, var(--bg-app));
border-bottom: 1px solid var(--border);
}
.executionCount {
min-width: 32px;
text-align: right;
font: var(--fs-small) var(--font-mono);
color: var(--fg-muted);
margin-right: 6px;
}
.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;
overflow: auto;
max-height: 640px;
user-select: text;
}
.textOutput,
.errorOutput,
.rawCell pre {
white-space: pre-wrap;
overflow-wrap: anywhere;
font: var(--openidea-editor-font-size, var(--fs-code)) / var(--openidea-editor-line-height, var(--lh-code, 1.5))
var(--font-mono);
margin: 0;
user-select: text;
}
.errorOutput {
color: var(--danger, var(--fg));
}
.outputImage {
display: block;
max-width: 100%;
height: auto;
margin: 4px 0;
}
.outputFrame {
display: block;
width: 100%;
height: 280px;
min-height: 80px;
max-height: 600px;
border: 1px solid var(--border);
background: white;
resize: vertical;
box-sizing: border-box;
}
.notice {
color: var(--fg-muted);
font-size: var(--fs-small);
padding: 4px 0;
margin: 0;
user-select: text;
}
.rawCell {
padding: 8px 12px;
max-height: 480px;
overflow: auto;
}
.markdown {
padding: 8px 14px;
min-height: 32px;
font-size: var(--markdown-preview-font-size, var(--fs-ui));
overflow-wrap: anywhere;
line-height: 1.6;
user-select: text;
}
.markdown > :first-child {
margin-top: 0;
}
.markdown > :last-child {
margin-bottom: 0;
}
.markdown img {
max-width: 100%;
height: auto;
}
.markdown pre {
overflow: auto;
padding: 8px;
background: var(--bg-elev);
font-family: var(--font-mono);
}
.markdown code {
font-family: var(--font-mono);
}
.markdown a {
color: var(--link);
cursor: pointer;
}
.markdown table {
border-collapse: collapse;
display: block;
overflow: auto;
}
.markdown th,
.markdown td {
border: 1px solid var(--border);
padding: 4px 8px;
}
.addBar {
display: flex;
justify-content: center;
gap: var(--space-2);
flex-wrap: wrap;
padding: 12px 16px 32px;
}
@media (max-width: 600px) {
.virtualCell {
padding: 5px;
}
.toolbar {
gap: var(--space-0-5);
}
.interpreter {
max-width: 180px;
}
.cellToolbar {
flex-wrap: wrap;
}
}