@@ -7,7 +7,7 @@ import * as DOM from 'vs/base/browser/dom';
77import { Disposable , DisposableStore } from 'vs/base/common/lifecycle' ;
88import { IEditorOptions } from 'vs/editor/common/config/editorOptions' ;
99import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
10- import { CellDiffViewModel } from 'vs/workbench/contrib/notebook/browser/diff/celllDiffViewModel' ;
10+ import { CellDiffViewModel , MetadataFoldingState } from 'vs/workbench/contrib/notebook/browser/diff/celllDiffViewModel' ;
1111import { CellDiffRenderTemplate , CellDiffViewModelLayoutChangeEvent , INotebookTextDiffEditor } from 'vs/workbench/contrib/notebook/browser/diff/common' ;
1212import { EDITOR_BOTTOM_PADDING , EDITOR_TOP_PADDING } from 'vs/workbench/contrib/notebook/browser/constants' ;
1313import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget' ;
@@ -71,11 +71,6 @@ const fixedEditorOptions: IEditorOptions = {
7171 renderValidationDecorations : 'on'
7272} ;
7373
74- enum MetadataFoldingState {
75- Expanded ,
76- Collapsed
77- }
78-
7974abstract class AbstractCellRenderer extends Disposable {
8075 protected _metadataHeaderContainer ! : HTMLElement ;
8176 protected _metadataInfoContainer ! : HTMLElement ;
@@ -89,7 +84,6 @@ abstract class AbstractCellRenderer extends Disposable {
8984 bodyMargin : number ;
9085 } ;
9186 protected _foldingIndicator ! : HTMLElement ;
92- protected _foldingState ! : MetadataFoldingState ;
9387 protected _metadataEditorContainer ?: HTMLElement ;
9488 protected _metadataEditorDisposeStore ! : DisposableStore ;
9589 protected _metadataEditor ?: CodeEditorWidget ;
@@ -114,7 +108,6 @@ abstract class AbstractCellRenderer extends Disposable {
114108 bodyMargin : 16
115109 } ;
116110 this . _metadataEditorDisposeStore = new DisposableStore ( ) ;
117- this . _foldingState = MetadataFoldingState . Collapsed ;
118111 this . initData ( ) ;
119112 this . buildBody ( templateData . container ) ;
120113 this . _register ( cell . onDidLayoutChange ( e => this . onDidLayoutChange ( e ) ) ) ;
@@ -175,7 +168,7 @@ abstract class AbstractCellRenderer extends Disposable {
175168 const cellViewModel = e . target ;
176169
177170 if ( cellViewModel === this . cell ) {
178- this . _foldingState = this . _foldingState === MetadataFoldingState . Expanded ? MetadataFoldingState . Collapsed : MetadataFoldingState . Expanded ;
171+ this . cell . foldingState = this . cell . foldingState === MetadataFoldingState . Expanded ? MetadataFoldingState . Collapsed : MetadataFoldingState . Expanded ;
179172 this . updateMetadataRendering ( ) ;
180173 }
181174 }
@@ -187,7 +180,7 @@ abstract class AbstractCellRenderer extends Disposable {
187180 }
188181
189182 updateMetadataRendering ( ) {
190- if ( this . _foldingState === MetadataFoldingState . Expanded ) {
183+ if ( this . cell . foldingState === MetadataFoldingState . Expanded ) {
191184 // we should expand the metadata editor
192185 this . _metadataInfoContainer . style . display = 'block' ;
193186
@@ -214,7 +207,7 @@ abstract class AbstractCellRenderer extends Disposable {
214207 this . layout ( { metadataEditor : true } ) ;
215208
216209 this . _register ( this . _metadataEditor . onDidContentSizeChange ( ( e ) => {
217- if ( e . contentHeightChanged && this . _foldingState === MetadataFoldingState . Expanded ) {
210+ if ( e . contentHeightChanged && this . cell . foldingState === MetadataFoldingState . Expanded ) {
218211 this . _layoutInfo . metadataHeight = e . contentHeight ;
219212 this . layout ( { metadataEditor : true } ) ;
220213 }
@@ -236,7 +229,7 @@ abstract class AbstractCellRenderer extends Disposable {
236229 }
237230
238231 private _updateFoldingIcon ( ) {
239- if ( this . _foldingState === MetadataFoldingState . Collapsed ) {
232+ if ( this . cell . foldingState === MetadataFoldingState . Collapsed ) {
240233 this . _foldingIndicator . innerHTML = renderCodicons ( '$(chevron-right)' ) ;
241234 } else {
242235 this . _foldingIndicator . innerHTML = renderCodicons ( '$(chevron-down)' ) ;
0 commit comments