Skip to content

Commit bedf867

Browse files
committed
#131808 - Set up output collapsed part in cell template
1 parent 722cbe1 commit bedf867

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,8 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
535535
toJSON: () => { return {}; }
536536
};
537537

538+
this.setupOutputCollapsedPart(templateData);
539+
538540
this.dndController?.registerDragHandle(templateData, rootContainer, dragHandle.domNode, () => new CodeCellDragImageRenderer().getDragImage(templateData, templateData.editor, 'code'));
539541

540542
templateDisposables.add(this.addCollapseClickCollapseHandler(templateData));
@@ -555,9 +557,10 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
555557
return templateData;
556558
}
557559

558-
private setupOutputCollapsedPart(templateData: CodeCellRenderTemplate, cellOutputCollapseContainer: HTMLElement, element: CodeCellViewModel) {
560+
private setupOutputCollapsedPart(templateData: CodeCellRenderTemplate) {
561+
const cellOutputCollapseContainer = templateData.cellOutputCollapsedContainer;
559562
const placeholder = DOM.append(cellOutputCollapseContainer, $('span.expandOutputPlaceholder')) as HTMLElement;
560-
placeholder.textContent = 'Outputs are collapsed';
563+
placeholder.textContent = localize('cellOutputsCollapsedMsg', "Outputs are collapsed");
561564
const expandIcon = DOM.append(cellOutputCollapseContainer, $('span.expandOutputIcon'));
562565
expandIcon.classList.add(...CSSIcon.asClassNameArray(Codicon.more));
563566

@@ -680,7 +683,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
680683
}
681684

682685
private updateForLayout(element: CodeCellViewModel, templateData: CodeCellRenderTemplate): void {
683-
templateData.templateDisposables.add(DOM.scheduleAtNextAnimationFrame(() => {
686+
templateData.elementDisposables.add(DOM.scheduleAtNextAnimationFrame(() => {
684687
const layoutInfo = this.notebookEditor.notebookOptions.getLayoutConfiguration();
685688
const bottomToolbarDimensions = this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType);
686689
templateData.focusIndicatorLeft.setHeight(element.layoutInfo.indicatorHeight);
@@ -722,9 +725,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
722725
}
723726

724727
templateData.outputContainer.domNode.innerText = '';
725-
const cellOutputCollapsedContainer = DOM.append(templateData.outputContainer.domNode, $('.output-collapse-container'));
726-
templateData.cellOutputCollapsedContainer = cellOutputCollapsedContainer;
727-
this.setupOutputCollapsedPart(templateData, cellOutputCollapsedContainer, element);
728+
templateData.outputContainer.domNode.appendChild(templateData.cellOutputCollapsedContainer);
728729

729730
const elementDisposables = templateData.elementDisposables;
730731
elementDisposables.add(templateData.instantiationService.createInstance(CodeCell, this.notebookEditor, element, templateData));

0 commit comments

Comments
 (0)