Skip to content

Commit 2f9fccb

Browse files
committed
Add NotebookTools widget in right panel
1 parent 090757b commit 2f9fccb

File tree

5 files changed

+40
-3
lines changed

5 files changed

+40
-3
lines changed

app/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ async function main() {
9191
'@jupyterlab/apputils-extension:toolbar-registry'
9292
].includes(id)
9393
),
94+
require('@jupyterlab/celltags-extension'),
9495
require('@jupyterlab/codemirror-extension').default.filter(({ id }) =>
9596
[
9697
'@jupyterlab/codemirror-extension:services',
@@ -137,6 +138,7 @@ async function main() {
137138
'@jupyterlab/notebook-extension:export',
138139
'@jupyterlab/notebook-extension:factory',
139140
'@jupyterlab/notebook-extension:toc',
141+
'@jupyterlab/notebook-extension:tools',
140142
'@jupyterlab/notebook-extension:tracker',
141143
'@jupyterlab/notebook-extension:widget-factory'
142144
].includes(id)

app/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@jupyterlab/cell-toolbar": "~4.0.0-alpha.10",
2929
"@jupyterlab/cell-toolbar-extension": "~4.0.0-alpha.10",
3030
"@jupyterlab/celltags": "~4.0.0-alpha.10",
31+
"@jupyterlab/celltags-extension": "~4.0.0-alpha.10",
3132
"@jupyterlab/codeeditor": "~4.0.0-alpha.10",
3233
"@jupyterlab/codemirror-extension": "~4.0.0-alpha.10",
3334
"@jupyterlab/completer": "~4.0.0-alpha.10",
@@ -110,6 +111,7 @@
110111
"@jupyterlab/apputils-extension": "^4.0.0-alpha.10",
111112
"@jupyterlab/cell-toolbar-extension": "^4.0.0-alpha.10",
112113
"@jupyterlab/celltags": "^4.0.0-alpha.10",
114+
"@jupyterlab/celltags-extension": "^4.0.0-alpha.10",
113115
"@jupyterlab/codemirror-extension": "^4.0.0-alpha.10",
114116
"@jupyterlab/completer-extension": "^4.0.0-alpha.10",
115117
"@jupyterlab/console-extension": "^4.0.0-alpha.10",

packages/application-extension/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import { DocumentWidget } from '@jupyterlab/docregistry';
2828

2929
import { IMainMenu } from '@jupyterlab/mainmenu';
3030

31+
import { INotebookTools } from '@jupyterlab/notebook';
32+
3133
import { ISettingRegistry } from '@jupyterlab/settingregistry';
3234

3335
import { ITranslator } from '@jupyterlab/translation';
@@ -594,13 +596,14 @@ const topVisibility: JupyterFrontEndPlugin<void> = {
594596
const sidebarVisibility: JupyterFrontEndPlugin<void> = {
595597
id: '@jupyter-notebook/application-extension:sidebar',
596598
requires: [INotebookShell, ITranslator],
597-
optional: [IMainMenu, ISettingRegistry],
599+
optional: [IMainMenu, ISettingRegistry, INotebookTools],
598600
activate: (
599601
app: JupyterFrontEnd<JupyterFrontEnd.IShell>,
600602
notebookShell: INotebookShell,
601603
translator: ITranslator,
602604
menu: IMainMenu | null,
603-
settingRegistry: ISettingRegistry | null
605+
settingRegistry: ISettingRegistry | null,
606+
notebookTools: INotebookTools | null
604607
) => {
605608
if (!sidePanelsEnabled()) {
606609
return;
@@ -687,6 +690,8 @@ const sidebarVisibility: JupyterFrontEndPlugin<void> = {
687690

688691
notebookShell.leftHandler.updateMenu();
689692
notebookShell.rightHandler.updateMenu();
693+
694+
if (notebookTools) notebookShell.add(notebookTools, 'right');
690695
}
691696
});
692697
},

ui-tests/test/notebook.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,22 @@ test.describe('Notebook', () => {
116116
)
117117
).toHaveCount(3);
118118
});
119+
120+
test('Open notebook tools right panel', async ({ page, tmpPath }) => {
121+
const notebook = 'simple.ipynb';
122+
const menuPath = 'View>Show Right Sidebar>Table Of Contents';
123+
await page.contents.uploadFile(
124+
path.resolve(__dirname, `./notebooks/${notebook}`),
125+
`${tmpPath}/${notebook}`
126+
);
127+
await page.goto(`notebooks/${tmpPath}/${notebook}`);
128+
129+
await waitForKernelReady(page);
130+
131+
await page.menu.open(menuPath);
132+
133+
await page.isVisible('#notebook-tools.jp-NotebookTools');
134+
135+
await page.isVisible('#notebook-tools.jp-NotebookTools > #add-tag.tag');
136+
});
119137
});

yarn.lock

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,17 @@
16541654
"@lumino/widgets" "^1.32.0"
16551655
react "^17.0.1"
16561656

1657-
"@jupyterlab/celltags@^4.0.0-alpha.10":
1657+
"@jupyterlab/celltags-extension@^4.0.0-alpha.10":
1658+
version "4.0.0-alpha.11"
1659+
resolved "https://registry.yarnpkg.com/@jupyterlab/celltags-extension/-/celltags-extension-4.0.0-alpha.11.tgz#1566e425673a224723870c13aa509d3698700627"
1660+
integrity sha512-uz4NUhD72SBQbhpbY2RBHUUU/+Q+9JR5XB2YptpO6M+NuDe6+1R2DYm1eupDQmOVLCO7JZd3c2D9LEEOYJlrMg==
1661+
dependencies:
1662+
"@jupyterlab/application" "^4.0.0-alpha.11"
1663+
"@jupyterlab/celltags" "^4.0.0-alpha.11"
1664+
"@jupyterlab/notebook" "^4.0.0-alpha.11"
1665+
"@jupyterlab/translation" "^4.0.0-alpha.11"
1666+
1667+
"@jupyterlab/celltags@^4.0.0-alpha.10", "@jupyterlab/celltags@^4.0.0-alpha.11":
16581668
version "4.0.0-alpha.11"
16591669
resolved "https://registry.yarnpkg.com/@jupyterlab/celltags/-/celltags-4.0.0-alpha.11.tgz#a6da321605ffa2ac92db2ea81a85742cfb8bb925"
16601670
integrity sha512-MB/qi/NzNUrfuoq8O5lfJe1r+mPvRSvlHZmtjQ+QeXhPFNeNSxMwOwwOmrVqIC72FpjlMYKEUvlVrrtEfIfUOA==

0 commit comments

Comments
 (0)