@@ -59,12 +59,12 @@ async function activateTOC(
59
59
app : JupyterFrontEnd ,
60
60
docmanager : IDocumentManager ,
61
61
editorTracker : IEditorTracker ,
62
- labShell : ILabShell ,
63
62
restorer : ILayoutRestorer ,
64
63
markdownViewerTracker : IMarkdownViewerTracker ,
65
64
notebookTracker : INotebookTracker ,
66
65
rendermime : IRenderMimeRegistry ,
67
66
translator : ITranslator ,
67
+ labShell ?: ILabShell ,
68
68
settingRegistry ?: ISettingRegistry
69
69
) : Promise < ITableOfContentsRegistry > {
70
70
const trans = translator . load ( 'jupyterlab' ) ;
@@ -85,7 +85,7 @@ async function activateTOC(
85
85
toc . node . setAttribute ( 'role' , 'region' ) ;
86
86
toc . node . setAttribute ( 'aria-label' , trans . __ ( 'Table of Contents section' ) ) ;
87
87
88
- labShell . add ( toc , 'left' , { rank : 400 } ) ;
88
+ app . shell . add ( toc , 'left' , { rank : 400 } ) ;
89
89
90
90
app . commands . addCommand ( CommandIDs . runCells , {
91
91
execute : args => {
@@ -121,11 +121,6 @@ async function activateTOC(
121
121
label : trans . __ ( 'Run Cell(s)' )
122
122
} ) ;
123
123
124
- app . contextMenu . addItem ( {
125
- selector : '.jp-tocItem' ,
126
- command : CommandIDs . runCells
127
- } ) ;
128
-
129
124
// Add the ToC widget to the application restorer:
130
125
restorer . add ( toc , '@jupyterlab/toc:plugin' ) ;
131
126
@@ -180,7 +175,9 @@ async function activateTOC(
180
175
registry . add ( pythonGenerator ) ;
181
176
182
177
// Update the ToC when the active widget changes:
183
- labShell . currentChanged . connect ( onConnect ) ;
178
+ if ( labShell ) {
179
+ labShell . currentChanged . connect ( onConnect ) ;
180
+ }
184
181
185
182
return registry ;
186
183
@@ -219,14 +216,13 @@ const extension: JupyterFrontEndPlugin<ITableOfContentsRegistry> = {
219
216
requires : [
220
217
IDocumentManager ,
221
218
IEditorTracker ,
222
- ILabShell ,
223
219
ILayoutRestorer ,
224
220
IMarkdownViewerTracker ,
225
221
INotebookTracker ,
226
222
IRenderMimeRegistry ,
227
223
ITranslator
228
224
] ,
229
- optional : [ ISettingRegistry ] ,
225
+ optional : [ ILabShell , ISettingRegistry ] ,
230
226
activate : activateTOC
231
227
} ;
232
228
0 commit comments