File tree 4 files changed +35
-0
lines changed
packages/notebook-extension 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 3
3
"description" : " Jupyter Notebook Menu Entries" ,
4
4
"jupyter.lab.menus" : {
5
5
"main" : [
6
+ {
7
+ "id" : " jp-mainmenu-file" ,
8
+ "items" : [
9
+ {
10
+ "command" : " notebook:open-tree-tab" ,
11
+ "rank" : 1
12
+ }
13
+ ]
14
+ },
6
15
{
7
16
"id" : " jp-mainmenu-edit" ,
8
17
"items" : [
Original file line number Diff line number Diff line change @@ -177,6 +177,31 @@ 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
+ optional : [ ITranslator ] ,
189
+ activate : ( app : JupyterFrontEnd , translator : ITranslator | null ) => {
190
+ const { commands } = app ;
191
+ translator = translator ?? nullTranslator ;
192
+ const trans = translator . load ( 'notebook' ) ;
193
+
194
+ const id = 'notebook:open-tree-tab' ;
195
+ commands . addCommand ( id , {
196
+ label : trans . __ ( 'Open…' ) ,
197
+ execute : async ( ) => {
198
+ const url = URLExt . join ( PageConfig . getBaseUrl ( ) , 'tree' ) ;
199
+ window . open ( url ) ;
200
+ } ,
201
+ } ) ;
202
+ } ,
203
+ } ;
204
+
180
205
/**
181
206
* The kernel logo plugin.
182
207
*/
@@ -570,6 +595,7 @@ const editNotebookMetadata: JupyterFrontEndPlugin<void> = {
570
595
const plugins : JupyterFrontEndPlugin < any > [ ] = [
571
596
checkpoints ,
572
597
closeTab ,
598
+ openTreeTab ,
573
599
editNotebookMetadata ,
574
600
kernelLogo ,
575
601
kernelStatus ,
You can’t perform that action at this time.
0 commit comments