@@ -50,22 +50,10 @@ import {
50
50
IDisposable
51
51
} from '@lumino/disposable' ;
52
52
53
- import { MessageLoop } from '@lumino/messaging' ;
54
-
55
53
import { Menu , Widget } from '@lumino/widgets' ;
56
54
57
55
import { SideBarPalette } from './sidebarpalette' ;
58
56
59
- /**
60
- * The default notebook factory.
61
- */
62
- const NOTEBOOK_FACTORY = 'Notebook' ;
63
-
64
- /**
65
- * The editor factory.
66
- */
67
- const EDITOR_FACTORY = 'Editor' ;
68
-
69
57
/**
70
58
* A regular expression to match path to notebooks and documents
71
59
*/
@@ -178,12 +166,10 @@ const opener: JupyterFrontEndPlugin<void> = {
178
166
id : '@jupyter-notebook/application-extension:opener' ,
179
167
autoStart : true ,
180
168
requires : [ IRouter , IDocumentManager ] ,
181
- optional : [ ISettingRegistry ] ,
182
169
activate : (
183
170
app : JupyterFrontEnd ,
184
171
router : IRouter ,
185
- docManager : IDocumentManager ,
186
- settingRegistry : ISettingRegistry | null
172
+ docManager : IDocumentManager
187
173
) : void => {
188
174
const { commands } = app ;
189
175
@@ -198,34 +184,13 @@ const opener: JupyterFrontEndPlugin<void> = {
198
184
}
199
185
200
186
const file = decodeURIComponent ( path ) ;
201
- const ext = PathExt . extname ( file ) ;
202
-
203
- // TODO: fix upstream?
204
- await settingRegistry ?. load ( '@jupyterlab/notebook-extension:panel' ) ;
205
-
206
- await new Promise ( async ( resolve , reject ) => {
207
- // TODO: get factory from file type instead?
208
- if ( ext === '.ipynb' ) {
209
- docManager . open ( file , NOTEBOOK_FACTORY , undefined , {
210
- ref : '_noref'
211
- } ) ;
212
- } else {
213
- docManager . open ( file , EDITOR_FACTORY , undefined , {
214
- ref : '_noref'
215
- } ) ;
216
- }
217
- resolve ( void 0 ) ;
187
+ const urlParams = new URLSearchParams ( parsed . search ) ;
188
+ const factory = urlParams . get ( 'factory' ) ?? 'default' ;
189
+ app . started . then ( async ( ) => {
190
+ docManager . open ( file , factory , undefined , {
191
+ ref : '_noref'
192
+ } ) ;
218
193
} ) ;
219
-
220
- // force triggering a resize event to try fixing toolbar rendering issues:
221
- // https://github.com/jupyter/notebook/issues/6553
222
- const currentWidget = app . shell . currentWidget ;
223
- if ( currentWidget ) {
224
- MessageLoop . sendMessage (
225
- currentWidget ,
226
- Widget . ResizeMessage . UnknownSize
227
- ) ;
228
- }
229
194
}
230
195
} ) ;
231
196
0 commit comments