Skip to content

Commit 7886ff1

Browse files
Chugunov RomanChugunov Roman
authored andcommitted
Fix open in new tab in new tab
1 parent 2a41f66 commit 7886ff1

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/main/webContent/WindowManager.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class WindowManager implements IWindowManager {
4848
this.mainWindow.setBrowserView(tab);
4949
tab.webContents.on('will-navigate', this.onMainWindowWillNavigate);
5050
tab.webContents.on('new-window', (event: Event, url: string, fileName: string, disposition, options, additionalFeatures) => {
51-
// console.log('mainWindow.webContents will-navigate: ', url, fileName, disposition, options, additionalFeatures);
5251
let view;
5352

5453
this.getZoom().then(zoom => {
@@ -111,6 +110,23 @@ class WindowManager implements IWindowManager {
111110
}, 'loadMainContetnt.js');
112111
this.mainWindow.setBrowserView(view);
113112
view.webContents.on('will-navigate', this.onMainWindowWillNavigate);
113+
view.webContents.on('new-window', (event: Event, url: string, fileName: string, disposition, options, additionalFeatures) => {
114+
let view;
115+
116+
this.getZoom().then(zoom => {
117+
view = Tabs.newTab(`${url}`, {
118+
x: 0,
119+
y: parseInt((28 * zoom+'').substr(0,4)),
120+
width: this.mainWindow.getContentBounds().width,
121+
height: this.mainWindow.getContentBounds().height - parseInt((28 * zoom+'').substr(0,4))
122+
}, 'loadContetnt.js');
123+
124+
view.webContents.on('will-navigate', this.onMainWindowWillNavigate);
125+
126+
this.mainWindow.setBrowserView(view);
127+
this.mainWindow.webContents.send(TABADDED, { id: view.id, url});
128+
})
129+
});
114130

115131
this.mainWindow.webContents.send(TABADDED, { id: view.id, url: `${this.home}/login`});
116132
});

0 commit comments

Comments
 (0)