Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing "Open..." file menu #7385

Merged
merged 8 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
"description": "Jupyter Notebook Menu Entries",
"jupyter.lab.menus": {
"main": [
{
"id": "jp-mainmenu-file",
"items": [
{
"command": "notebook:open-tree-tab",
"rank": 1
}
]
},
{
"id": "jp-mainmenu-edit",
"items": [
Expand Down
26 changes: 26 additions & 0 deletions packages/notebook-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,31 @@ const closeTab: JupyterFrontEndPlugin<void> = {
},
};

/**
* Add a command to open the tree view from the notebook view
*/
const openTreeTab: JupyterFrontEndPlugin<void> = {
id: '@jupyter-notebook/notebook-extension:open-tree-tab',
description:
'Add a command to open a browser tab on the tree view when clicking "Open...".',
autoStart: true,
optional: [ITranslator],
activate: (app: JupyterFrontEnd, translator: ITranslator | null) => {
const { commands } = app;
translator = translator ?? nullTranslator;
const trans = translator.load('notebook');

const id = 'notebook:open-tree-tab';
commands.addCommand(id, {
label: trans.__('Open…'),
execute: async () => {
const url = URLExt.join(PageConfig.getBaseUrl(), 'tree');
window.open(url);
},
});
},
};

/**
* The kernel logo plugin.
*/
Expand Down Expand Up @@ -570,6 +595,7 @@ const editNotebookMetadata: JupyterFrontEndPlugin<void> = {
const plugins: JupyterFrontEndPlugin<any>[] = [
checkpoints,
closeTab,
openTreeTab,
editNotebookMetadata,
kernelLogo,
kernelStatus,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading