File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
packages/notebook-extension/src Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,40 @@ const closeTab: JupyterFrontEndPlugin<void> = {
177
177
} ,
178
178
} ;
179
179
180
+ /**
181
+ * Add a command to open the tree view from the notebook view
182
+ */
183
+ const openTreeTab : JupyterFrontEndPlugin < void > = {
184
+ id : '@jupyter-notebook/notebook-extension:open-tree-tab' ,
185
+ description :
186
+ 'Add a command to open a browser tab on the tree view when clicking "Open...".' ,
187
+ autoStart : true ,
188
+ requires : [ IMainMenu ] ,
189
+ optional : [ ITranslator ] ,
190
+ activate : (
191
+ app : JupyterFrontEnd ,
192
+ menu : IMainMenu ,
193
+ translator : ITranslator | null
194
+ ) => {
195
+ const { commands } = app ;
196
+ translator = translator ?? nullTranslator ;
197
+ const trans = translator . load ( 'notebook' ) ;
198
+
199
+ const id = 'notebook:open-tree-tab' ;
200
+ commands . addCommand ( id , {
201
+ label : trans . __ ( 'Open...' ) ,
202
+ execute : async ( ) => {
203
+ const url = URLExt . join ( PageConfig . getBaseUrl ( ) , 'tree' ) ;
204
+ window . open ( url ) ;
205
+ } ,
206
+ } ) ;
207
+ menu . fileMenu . addItem ( {
208
+ command : id ,
209
+ rank : 1 ,
210
+ } ) ;
211
+ } ,
212
+ } ;
213
+
180
214
/**
181
215
* The kernel logo plugin.
182
216
*/
@@ -570,6 +604,7 @@ const editNotebookMetadata: JupyterFrontEndPlugin<void> = {
570
604
const plugins : JupyterFrontEndPlugin < any > [ ] = [
571
605
checkpoints ,
572
606
closeTab ,
607
+ openTreeTab ,
573
608
editNotebookMetadata ,
574
609
kernelLogo ,
575
610
kernelStatus ,
You can’t perform that action at this time.
0 commit comments