@@ -4,15 +4,23 @@ import {
44} from '@jupyterlab/application' ;
55
66import { IToolbarWidgetRegistry , ToolbarButton } from '@jupyterlab/apputils' ;
7- import { NotebookPanel } from '@jupyterlab/notebook' ;
8- import { Widget } from '@lumino/widgets' ;
7+ import {
8+ INotebookWidgetFactory ,
9+ NotebookPanel ,
10+ NotebookWidgetFactory
11+ } from '@jupyterlab/notebook' ;
12+ // import { Widget } from '@lumino/widgets';
913
1014const plugin : JupyterFrontEndPlugin < void > = {
1115 id : 'jupyterlab-deepnote:plugin' ,
1216 description : 'Open .deepnote files as notebooks.' ,
1317 autoStart : true ,
14- requires : [ IToolbarWidgetRegistry ] ,
15- activate : ( app : JupyterFrontEnd , toolbarRegistry : IToolbarWidgetRegistry ) => {
18+ requires : [ INotebookWidgetFactory , IToolbarWidgetRegistry ] ,
19+ activate : (
20+ app : JupyterFrontEnd ,
21+ notebookWidgetFactory : NotebookWidgetFactory ,
22+ toolbarRegistry : IToolbarWidgetRegistry
23+ ) => {
1624 // 1) File type
1725 app . docRegistry . addFileType (
1826 {
@@ -23,18 +31,22 @@ const plugin: JupyterFrontEndPlugin<void> = {
2331 fileFormat : 'text' ,
2432 contentType : 'file'
2533 } ,
26- [ 'Notebook' ]
34+ [ notebookWidgetFactory . name ]
2735 ) ;
2836
29- app . docRegistry . setDefaultWidgetFactory ( 'deepnote' , 'Notebook' ) ;
37+ app . docRegistry . setDefaultWidgetFactory (
38+ 'deepnote' ,
39+ notebookWidgetFactory . name
40+ ) ;
3041
3142 toolbarRegistry . addFactory < NotebookPanel > (
32- 'Notebook' ,
43+ notebookWidgetFactory . name ,
3344 'deepnote:switch-notebook' ,
3445 panel => {
35- if ( ! panel . context . path . endsWith ( '.deepnote' ) ) {
36- return new Widget ( ) ; // don’t render for .ipynb or others
37- }
46+ console . log ( '🚨🚨🚨🚨 toolbar item factory' ) ;
47+ // if (!panel.context.path.endsWith('.deepnote')) {
48+ // return new Widget(); // don’t render for .ipynb or others
49+ // }
3850
3951 return new ToolbarButton ( {
4052 className : 'debug-deepnote-button' ,
0 commit comments