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 {
6666
6767 // Open external links in system browser
6868 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
6982 shell . openExternal ( url ) ;
7083 return { action : 'deny' } ;
84+ }
7185 } ) ;
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.
7291
7392 this . _view . setBackgroundColor (
7493 options . isDarkTheme ? DarkThemeBGColor : LightThemeBGColor
You can’t perform that action at this time.
0 commit comments