File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 6
6
clipboard ,
7
7
dialog ,
8
8
Menu ,
9
- MenuItemConstructorOptions
9
+ MenuItemConstructorOptions ,
10
+ shell
10
11
} from 'electron' ;
11
12
import log from 'electron-log' ;
12
13
import * as path from 'path' ;
@@ -63,6 +64,17 @@ export class LabView implements IDisposable {
63
64
}
64
65
} ) ;
65
66
67
+ // Open external links in system browser
68
+ this . _view . webContents . setWindowOpenHandler ( ( { url } ) => {
69
+ const jlab_host = `${ sessionConfig . url . protocol } //${ sessionConfig . url . host } `
70
+ if ( url . startsWith ( jlab_host ) ) {
71
+ return { action : 'allow' } ;
72
+ } else {
73
+ shell . openExternal ( url ) ;
74
+ return { action : 'deny' } ;
75
+ }
76
+ } ) ;
77
+
66
78
this . _view . setBackgroundColor (
67
79
options . isDarkTheme ? DarkThemeBGColor : LightThemeBGColor
68
80
) ;
You can’t perform that action at this time.
0 commit comments