File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -66,9 +66,28 @@ export class LabView implements IDisposable {
66
66
67
67
// Open external links in system browser
68
68
this . _view . webContents . setWindowOpenHandler ( ( { url } ) => {
69
+ // if Jupyter Lab wants to open a new window, let it open a new window
70
+ const jlab_host = `${ sessionConfig . url . protocol } //${ sessionConfig . url . host } `
71
+ if ( url . startsWith ( jlab_host ) ) {
72
+ return {
73
+ action : 'allow' ,
74
+ createWindow : ( options : any ) => {
75
+ const browserView = new BrowserView ( options )
76
+ this . _parent . window . addBrowserView ( browserView )
77
+ return browserView . webContents
78
+ }
79
+ } ;
80
+ } else {
81
+ // otherwise open in system browser
69
82
shell . openExternal ( url ) ;
70
83
return { action : 'deny' } ;
84
+ }
71
85
} ) ;
86
+ // TODO:
87
+ // 1. Opening jupyter notebook creates a window that is not decorated like main labview.
88
+ // This is the same behaviour as the main branch.
89
+ // 2. Opening links in jupyter windows opened from jupyter labs has old behaviour
90
+ // 3. Opening jupyter lab from jupyter notebook creates an undecorated window.
72
91
73
92
this . _view . setBackgroundColor (
74
93
options . isDarkTheme ? DarkThemeBGColor : LightThemeBGColor
You can’t perform that action at this time.
0 commit comments