Skip to content

Commit 49644b8

Browse files
authored
Use Toolbar registry for the notebok button and move it to the right (#24)
1 parent 5976c33 commit 49644b8

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-20
lines changed

js/jupyterlab-slideshow/schema/plugin.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@
3030
"description": "Configure Deck Settings",
3131
"jupyter.lab.setting-icon": "deck:start",
3232
"jupyter.lab.setting-icon-label": "Decks",
33+
"jupyter.lab.toolbars": {
34+
"Notebook": [
35+
{
36+
"name": "deck",
37+
"command": "deck:toggle",
38+
"rank": 900
39+
}
40+
]
41+
},
3342
"properties": {
3443
"active": {
3544
"title": "Activate Deck",
Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,27 @@
1-
import { CommandToolbarButton } from '@jupyterlab/apputils';
21
import { DocumentRegistry } from '@jupyterlab/docregistry';
32
import { NotebookPanel, INotebookModel } from '@jupyterlab/notebook';
4-
import { CommandRegistry } from '@lumino/commands';
5-
import { IDisposable, DisposableDelegate } from '@lumino/disposable';
6-
7-
import { CommandIds } from '../tokens';
83

94
import { NotebookPresenter } from './presenter';
105

116
export class NotebookDeckExtension
127
implements DocumentRegistry.IWidgetExtension<NotebookPanel, INotebookModel>
138
{
14-
private _commands: CommandRegistry;
159
private _presenter: NotebookPresenter;
1610

1711
constructor(options: DeckExtension.IOptions) {
18-
this._commands = options.commands;
1912
this._presenter = options.presenter;
2013
}
2114

2215
createNew(
2316
panel: NotebookPanel,
2417
context: DocumentRegistry.IContext<INotebookModel>,
25-
): IDisposable {
26-
const button = new CommandToolbarButton({
27-
commands: this._commands,
28-
label: '',
29-
id: CommandIds.toggle,
30-
});
31-
32-
panel.toolbar.insertItem(5, 'deck', button);
33-
18+
): void {
3419
this._presenter.preparePanel(panel);
35-
36-
return new DisposableDelegate(() => button.dispose());
3720
}
3821
}
3922

4023
export namespace DeckExtension {
4124
export interface IOptions {
42-
commands: CommandRegistry;
4325
presenter: NotebookPresenter;
4426
}
4527
}

js/jupyterlab-slideshow/src/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const notebookPlugin: JupyterFrontEndPlugin<void> = {
100100

101101
app.docRegistry.addWidgetExtension(
102102
NOTEBOOK_FACTORY,
103-
new NotebookDeckExtension({ commands, presenter }),
103+
new NotebookDeckExtension({ presenter }),
104104
);
105105
},
106106
};

0 commit comments

Comments
 (0)