File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,15 @@ class CodeMirrorSplitDiffWidget extends BaseDiffWidget {
6969 python ( ) ,
7070 EditorView . editable . of ( true ) ,
7171 jupyterTheme ,
72- splitDiffDecorationField
72+ splitDiffDecorationField ,
73+ EditorView . updateListener . of ( update => {
74+ if ( update . docChanged ) {
75+ const newText = update . state . doc . toString ( ) ;
76+
77+ this . _modifiedCode = newText ;
78+ this . _newSource = newText ;
79+ }
80+ } )
7381 ]
7482 } ,
7583 parent : this . node ,
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ export abstract class BaseDiffWidget extends Widget {
100100 */
101101 public onAcceptClick ( ) : void {
102102 if ( this . _cell ) {
103- this . _cell . sharedModel . setSource ( this . _newSource ) ;
103+ this . _cell . sharedModel . setSource ( this . _newSource || this . _originalSource ) ;
104104 this . _closeDiffView ( ) ;
105105 }
106106 }
@@ -191,9 +191,9 @@ export abstract class BaseDiffWidget extends Widget {
191191 private _cell : ICellModel ;
192192 private _cellFooterTracker : ICellFooterTracker ;
193193 private _originalSource : string ;
194- private _newSource : string ;
195194 private _showActionButtons : boolean ;
196195 private _openDiff : boolean ;
197196 private _toggleButton : ToolbarButton | null = null ;
198197 private _trans : TranslationBundle ;
198+ public _newSource : string ;
199199}
You can’t perform that action at this time.
0 commit comments