-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Toolbar registry for the notebok button and move it to the right (#…
…24)
- Loading branch information
Showing
3 changed files
with
11 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters