Skip to content
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
9 changes: 9 additions & 0 deletions js/jupyterlab-slideshow/schema/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@
"description": "Configure Deck Settings",
"jupyter.lab.setting-icon": "deck:start",
"jupyter.lab.setting-icon-label": "Decks",
"jupyter.lab.toolbars": {
"Notebook": [
{
"name": "deck",
"command": "deck:toggle",
"rank": 900
}
]
},
"properties": {
"active": {
"title": "Activate Deck",
Expand Down
20 changes: 1 addition & 19 deletions js/jupyterlab-slideshow/src/notebook/extension.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,27 @@
import { CommandToolbarButton } from '@jupyterlab/apputils';
import { DocumentRegistry } from '@jupyterlab/docregistry';
import { NotebookPanel, INotebookModel } from '@jupyterlab/notebook';
import { CommandRegistry } from '@lumino/commands';
import { IDisposable, DisposableDelegate } from '@lumino/disposable';

import { CommandIds } from '../tokens';

import { NotebookPresenter } from './presenter';

export class NotebookDeckExtension
implements DocumentRegistry.IWidgetExtension<NotebookPanel, INotebookModel>
{
private _commands: CommandRegistry;
private _presenter: NotebookPresenter;

constructor(options: DeckExtension.IOptions) {
this._commands = options.commands;
this._presenter = options.presenter;
}

createNew(
panel: NotebookPanel,
context: DocumentRegistry.IContext<INotebookModel>,
): IDisposable {
const button = new CommandToolbarButton({
commands: this._commands,
label: '',
id: CommandIds.toggle,
});

panel.toolbar.insertItem(5, 'deck', button);

): void {
this._presenter.preparePanel(panel);

return new DisposableDelegate(() => button.dispose());
}
}

export namespace DeckExtension {
export interface IOptions {
commands: CommandRegistry;
presenter: NotebookPresenter;
}
}
2 changes: 1 addition & 1 deletion js/jupyterlab-slideshow/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const notebookPlugin: JupyterFrontEndPlugin<void> = {

app.docRegistry.addWidgetExtension(
NOTEBOOK_FACTORY,
new NotebookDeckExtension({ commands, presenter }),
new NotebookDeckExtension({ presenter }),
);
},
};
Expand Down
Loading