@@ -53,6 +53,7 @@ const fixedDiffEditorOptions: IDiffEditorOptions = {
5353 glyphMargin : true ,
5454 enableSplitViewResizing : false ,
5555 renderIndicators : false ,
56+ readOnly : false
5657} ;
5758
5859
@@ -355,8 +356,8 @@ abstract class AbstractCellRenderer extends Disposable {
355356 if ( originalMetadataSource !== modifiedMetadataSource ) {
356357 this . _metadataEditor = this . instantiationService . createInstance ( DiffEditorWidget , this . _metadataEditorContainer ! , {
357358 ...fixedDiffEditorOptions ,
358- overflowWidgetsDomNode : this . notebookEditor . getOverflowContainerDomNode ( )
359-
359+ overflowWidgetsDomNode : this . notebookEditor . getOverflowContainerDomNode ( ) ,
360+ readOnly : true
360361 } ) ;
361362
362363 DOM . addClass ( this . _metadataEditorContainer ! , 'diff' ) ;
@@ -427,7 +428,8 @@ abstract class AbstractCellRenderer extends Disposable {
427428 if ( originalOutputsSource !== modifiedOutputsSource ) {
428429 this . _outputEditor = this . instantiationService . createInstance ( DiffEditorWidget , this . _outputEditorContainer ! , {
429430 ...fixedDiffEditorOptions ,
430- overflowWidgetsDomNode : this . notebookEditor . getOverflowContainerDomNode ( )
431+ overflowWidgetsDomNode : this . notebookEditor . getOverflowContainerDomNode ( ) ,
432+ readOnly : true
431433 } ) ;
432434
433435 DOM . addClass ( this . _outputEditorContainer ! , 'diff' ) ;
@@ -504,93 +506,6 @@ abstract class AbstractCellRenderer extends Disposable {
504506 abstract layout ( state : { outerWidth ?: boolean , editorHeight ?: boolean , metadataEditor ?: boolean , outputEditor ?: boolean } ) : void ;
505507}
506508
507- export class UnchangedCell extends AbstractCellRenderer {
508- private _editor ! : CodeEditorWidget ;
509-
510- constructor (
511- readonly notebookEditor : INotebookTextDiffEditor ,
512- readonly cell : CellDiffViewModel ,
513- readonly templateData : CellDiffRenderTemplate ,
514- @IModeService readonly modeService : IModeService ,
515- @IModelService protected modelService : IModelService ,
516- @IInstantiationService protected readonly instantiationService : IInstantiationService ,
517- ) {
518- super ( notebookEditor , cell , templateData , 'full' , instantiationService , modeService , modelService ) ;
519- }
520-
521- initData ( ) {
522- }
523-
524- styleContainer ( container : HTMLElement ) {
525- }
526-
527- buildSourceEditor ( sourceContainer : HTMLElement ) {
528- const editorContainer = DOM . append ( sourceContainer , DOM . $ ( '.editor-container' ) ) ;
529- const originalCell = this . cell . original ! ;
530- const lineCount = originalCell . textBuffer . getLineCount ( ) ;
531- const lineHeight = this . notebookEditor . getLayoutInfo ( ) . fontInfo . lineHeight || 17 ;
532- const editorHeight = lineCount * lineHeight + EDITOR_TOP_PADDING + EDITOR_BOTTOM_PADDING ;
533-
534- this . _editor = this . instantiationService . createInstance ( CodeEditorWidget , editorContainer , {
535- ...fixedEditorOptions ,
536- dimension : {
537- width : this . notebookEditor . getLayoutInfo ( ) . width - 2 * DIFF_CELL_MARGIN ,
538- height : editorHeight
539- } ,
540- overflowWidgetsDomNode : this . notebookEditor . getOverflowContainerDomNode ( )
541- } , { } ) ;
542-
543- this . _register ( this . _editor . onDidContentSizeChange ( ( e ) => {
544- if ( e . contentHeightChanged ) {
545- this . _layoutInfo . editorHeight = e . contentHeight ;
546- this . layout ( { editorHeight : true } ) ;
547- }
548- } ) ) ;
549-
550- originalCell . resolveTextModelRef ( ) . then ( ref => {
551- this . _register ( ref ) ;
552-
553- const textModel = ref . object . textEditorModel ;
554- this . _editor . setModel ( textModel ) ;
555-
556- this . _layoutInfo . editorHeight = this . _editor . getContentHeight ( ) ;
557- this . layout ( { editorHeight : true } ) ;
558- } ) ;
559- }
560-
561-
562- onDidLayoutChange ( event : CellDiffViewModelLayoutChangeEvent ) : void {
563- if ( event . outerWidth !== undefined ) {
564- this . layout ( { outerWidth : true } ) ;
565- }
566- }
567-
568- layout ( state : { outerWidth ?: boolean , editorHeight ?: boolean , metadataEditor ?: boolean , outputEditor ?: boolean } ) {
569- if ( state . editorHeight || state . outerWidth ) {
570- this . _editor . layout ( {
571- width : this . cell . getComputedCellContainerWidth ( this . notebookEditor . getLayoutInfo ( ) , false , true ) ,
572- height : this . _layoutInfo . editorHeight
573- } ) ;
574- }
575-
576- if ( state . metadataEditor || state . outerWidth ) {
577- this . _metadataEditor ?. layout ( {
578- width : this . cell . getComputedCellContainerWidth ( this . notebookEditor . getLayoutInfo ( ) , false , true ) ,
579- height : this . _layoutInfo . metadataHeight
580- } ) ;
581- }
582-
583- if ( state . outputEditor || state . outerWidth ) {
584- this . _outputEditor ?. layout ( {
585- width : this . cell . getComputedCellContainerWidth ( this . notebookEditor . getLayoutInfo ( ) , false , true ) ,
586- height : this . _layoutInfo . outputHeight
587- } ) ;
588- }
589-
590- this . layoutNotebookCell ( ) ;
591- }
592- }
593-
594509export class DeletedCell extends AbstractCellRenderer {
595510 private _editor ! : CodeEditorWidget ;
596511 constructor (
@@ -794,7 +709,8 @@ export class ModifiedCell extends AbstractCellRenderer {
794709
795710 this . _editor = this . instantiationService . createInstance ( DiffEditorWidget , this . _editorContainer , {
796711 ...fixedDiffEditorOptions ,
797- overflowWidgetsDomNode : this . notebookEditor . getOverflowContainerDomNode ( )
712+ overflowWidgetsDomNode : this . notebookEditor . getOverflowContainerDomNode ( ) ,
713+ originalEditable : false
798714 } ) ;
799715 DOM . addClass ( this . _editorContainer , 'diff' ) ;
800716
0 commit comments