File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5757 },
5858 "dependencies" : {
5959 "@jupyterlab/application" : " ^4.0.0" ,
60- "@jupyterlab/filebrowser" : " ^4.5.6"
60+ "@jupyterlab/filebrowser" : " ^4.5.6" ,
61+ "@jupyterlab/notebook" : " ^4.5.6"
6162 },
6263 "devDependencies" : {
6364 "@jupyterlab/builder" : " ^4.0.0" ,
Original file line number Diff line number Diff line change 66 {
77 "command" : " jupyter-ui-tweak/open-in-voila-command" ,
88 "selector" : " .jp-DirListing-item[data-file-type=\" notebook\" ]" ,
9- "rank" : 0
9+ "rank" : 3
1010 }
1111 ]
1212 },
Original file line number Diff line number Diff line change @@ -4,10 +4,11 @@ import {
44} from '@jupyterlab/application' ;
55import { IToolbarWidgetRegistry } from '@jupyterlab/apputils' ;
66import { ITranslator } from '@jupyterlab/translation' ;
7- import { caretDownIcon , tabIcon } from '@jupyterlab/ui-components' ;
7+ import { caretDownIcon , launchIcon } from '@jupyterlab/ui-components' ;
88import { Menu , MenuBar } from '@lumino/widgets' ;
99import { IFileBrowserFactory } from '@jupyterlab/filebrowser' ;
1010import { getVoilaUrl } from './tools' ;
11+ import { VoilaButton } from './voilabutton' ;
1112const FILE_BROWSER_FACTORY = 'FileBrowser' ;
1213
1314/**
@@ -108,7 +109,7 @@ const openInVoila: JupyterFrontEndPlugin<void> = {
108109 caption : 'Open selected notebook in Voila' ,
109110 isEnabled : ( ) => true ,
110111 isVisible : ( ) => true ,
111- icon : tabIcon ,
112+ icon : launchIcon ,
112113 execute : ( ) => {
113114 const file = factory . tracker . currentWidget
114115 ?. selectedItems ( )
@@ -119,6 +120,11 @@ const openInVoila: JupyterFrontEndPlugin<void> = {
119120 }
120121 }
121122 } ) ;
123+
124+ const { commands, docRegistry } = app ;
125+
126+ const voilaButton = new VoilaButton ( commands ) ;
127+ docRegistry . addWidgetExtension ( 'Notebook' , voilaButton ) ;
122128 }
123129} ;
124130
Original file line number Diff line number Diff line change 1+ import { ToolbarButton } from '@jupyterlab/apputils' ;
2+ import { DocumentRegistry } from '@jupyterlab/docregistry' ;
3+ import { INotebookModel , NotebookPanel } from '@jupyterlab/notebook' ;
4+ import { CommandRegistry } from '@lumino/commands' ;
5+ import { IDisposable } from '@lumino/disposable' ;
6+ import { launchIcon } from '@jupyterlab/ui-components' ;
7+
8+ export class VoilaButton implements DocumentRegistry . IWidgetExtension <
9+ NotebookPanel ,
10+ INotebookModel
11+ > {
12+ /**
13+ * Instantiate a new VoilaRenderButton.
14+ * @param commands The command registry.
15+ */
16+ constructor ( commands : CommandRegistry ) {
17+ this . _commands = commands ;
18+ }
19+
20+ /**
21+ * Create a new extension object.
22+ */
23+ createNew ( panel : NotebookPanel ) : IDisposable {
24+ const button = new ToolbarButton ( {
25+ tooltip : 'Open with Voilà' ,
26+ className : 'jp-tweak-open-in-voila-button' ,
27+ icon : launchIcon ,
28+ pressed : false ,
29+ noFocusOnClick : true ,
30+ onClick : ( ) => {
31+ this . _commands . execute ( 'notebook:open-with-voila' ) ;
32+ }
33+ } ) ;
34+ panel . toolbar . insertAfter ( 'cellType' , 'openInVoila' , button ) ;
35+ return button ;
36+ }
37+
38+ private _commands : CommandRegistry ;
39+ }
Original file line number Diff line number Diff line change 33
44 https://jupyterlab.readthedocs.io/en/stable/developer/css.html
55*/
6+
7+ .jp-tweak-open-in-voila-button [aria-pressed = 'true' ] {
8+ box-shadow : none !important ;
9+ }
You can’t perform that action at this time.
0 commit comments