File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ export abstract class BaseUnifiedDiffManager {
6969      return ; 
7070    } 
7171    this . _isDisposed  =  true ; 
72-     this . _deactivate ( ) ; 
72+     this . deactivate ( ) ; 
7373  } 
7474
7575  /** 
@@ -112,7 +112,7 @@ export abstract class BaseUnifiedDiffManager {
112112  /** 
113113   * Deactivate the diff view 
114114   */ 
115-   protected  _deactivate ( ) : void   { 
115+   protected  deactivate ( ) : void   { 
116116    this . removeToolbarButtons ( ) ; 
117117    this . _cleanupEditor ( ) ; 
118118    this . showCellToolbar ( ) ; 
@@ -137,7 +137,7 @@ export abstract class BaseUnifiedDiffManager {
137137   */ 
138138  protected  acceptAll ( ) : void   { 
139139    // simply accept the current state 
140-     this . _deactivate ( ) ; 
140+     this . deactivate ( ) ; 
141141  } 
142142
143143  /** 
@@ -146,7 +146,7 @@ export abstract class BaseUnifiedDiffManager {
146146  protected  rejectAll ( ) : void   { 
147147    const  sharedModel  =  this . getSharedModel ( ) ; 
148148    sharedModel . setSource ( this . _originalSource ) ; 
149-     this . _deactivate ( ) ; 
149+     this . deactivate ( ) ; 
150150  } 
151151
152152  /** 
@@ -166,7 +166,7 @@ export abstract class BaseUnifiedDiffManager {
166166      newSource : this . _newSource , 
167167      isInitialized : this . _isInitialized , 
168168      sharedModel : this . getSharedModel ( ) , 
169-       onChunkChange : ( )  =>  this . _deactivate ( ) 
169+       onChunkChange : ( )  =>  this . deactivate ( ) 
170170    } ) ; 
171171
172172    this . _isInitialized  =  true ; 
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export class UnifiedCellDiffManager extends BaseUnifiedDiffManager {
3737  } 
3838
3939  private  static  _activeDiffCount  =  0 ; 
40+   private  _toolbarObserver ?: MutationObserver ; 
4041
4142  /** 
4243   * Get the shared model for source manipulation 
@@ -61,29 +62,32 @@ export class UnifiedCellDiffManager extends BaseUnifiedDiffManager {
6162      subtree : true 
6263    } ) ; 
6364
64-     ( this   as   any ) . _toolbarObserver  =  observer ; 
65+     this . _toolbarObserver  =  observer ; 
6566  } 
6667
6768  /** 
6869   * Deactivate the diff view with cell toolbar. 
6970   */ 
70-   protected  _deactivate ( ) : void   { 
71-     super [ '_deactivate' ] ( ) ; 
71+   protected  deactivate ( ) : void   { 
72+     super . deactivate ( ) ; 
7273    UnifiedCellDiffManager . _activeDiffCount  =  Math . max ( 
7374      0 , 
7475      UnifiedCellDiffManager . _activeDiffCount  -  1 
7576    ) ; 
7677
77-     const   observer   =   ( this   as   any ) . _toolbarObserver   as   MutationObserver ; 
78-     if   ( observer )   { 
79-       observer . disconnect ( ) ; 
78+     if   ( this . _toolbarObserver )   { 
79+        this . _toolbarObserver . disconnect ( ) ; 
80+       this . _toolbarObserver   =   undefined ; 
8081    } 
8182  } 
83+ 
8284  /** 
8385   * Hide the cell's toolbar while the diff is active 
8486   */ 
8587  protected  hideCellToolbar ( ) : void   { 
86-     const  toolbar  =  this . _cell . node . querySelector ( 'jp-toolbar' )  as  HTMLElement ; 
88+     const  toolbar  =  this . _cell . node . querySelector ( 
89+       'jp-toolbar' 
90+     )  as  HTMLElement  |  null ; 
8791    if  ( toolbar )  { 
8892      toolbar . style . display  =  'none' ; 
8993    } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments