66import { Disposable } from '../../../../../../base/common/lifecycle.js' ;
77import { WorkbenchPhase , registerWorkbenchContribution2 } from '../../../../../common/contributions.js' ;
88import { UndoCommand , RedoCommand } from '../../../../../../editor/browser/editorExtensions.js' ;
9- import { IPositronNotebookService } from '../../positronNotebookService.js' ;
109import { POSITRON_NOTEBOOK_EDITOR_CONTAINER_FOCUSED , POSITRON_NOTEBOOK_CELL_EDITOR_FOCUSED } from '../../ContextKeysManager.js' ;
1110import { IUndoRedoService } from '../../../../../../platform/undoRedo/common/undoRedo.js' ;
1211import { IContextKeyService } from '../../../../../../platform/contextkey/common/contextkey.js' ;
12+ import { IEditorService } from '../../../../../services/editor/common/editorService.js' ;
13+ import { getActiveNotebook } from '../../notebookUtils.js' ;
1314
1415class PositronNotebookUndoRedoContribution extends Disposable {
1516
1617 static readonly ID = 'workbench.contrib.positronNotebookUndoRedo' ;
1718
1819 constructor (
1920 @IUndoRedoService private readonly undoRedoService : IUndoRedoService ,
20- @IPositronNotebookService private readonly positronNotebookService : IPositronNotebookService ,
21+ @IEditorService private readonly editorService : IEditorService ,
2122 @IContextKeyService private readonly contextKeyService : IContextKeyService
2223 ) {
2324 super ( ) ;
@@ -30,7 +31,7 @@ class PositronNotebookUndoRedoContribution extends Disposable {
3031
3132 private shouldHandleUndoRedo ( ) : boolean {
3233 // Get the active notebook instance to access its scoped context key service
33- const instance = this . positronNotebookService . getActiveInstance ( ) ;
34+ const instance = getActiveNotebook ( this . editorService ) ;
3435 if ( ! instance ) {
3536 return false ;
3637 }
@@ -61,7 +62,7 @@ class PositronNotebookUndoRedoContribution extends Disposable {
6162 return false ;
6263 }
6364
64- const instance = this . positronNotebookService . getActiveInstance ( ) ;
65+ const instance = getActiveNotebook ( this . editorService ) ;
6566 if ( ! instance ) {
6667 return false ;
6768 }
@@ -79,7 +80,7 @@ class PositronNotebookUndoRedoContribution extends Disposable {
7980 return false ;
8081 }
8182
82- const instance = this . positronNotebookService . getActiveInstance ( ) ;
83+ const instance = getActiveNotebook ( this . editorService ) ;
8384 if ( ! instance ) {
8485 return false ;
8586 }
0 commit comments