Correct window should be used if known - issue #287
This commit is contained in:
parent
29dc974fd6
commit
35ddc045e6
1 changed files with 23 additions and 6 deletions
29
index.js
29
index.js
|
@ -592,6 +592,7 @@ const ContainerService = {
|
||||||
userContextId: args.userContextId,
|
userContextId: args.userContextId,
|
||||||
url: object.url,
|
url: object.url,
|
||||||
nofocus: args.nofocus || false,
|
nofocus: args.nofocus || false,
|
||||||
|
window: args.window || null,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -777,7 +778,15 @@ const ContainerService = {
|
||||||
},
|
},
|
||||||
|
|
||||||
openTab(args) {
|
openTab(args) {
|
||||||
return this._recentBrowserWindow().then(browserWin => {
|
return new Promise(resolve => {
|
||||||
|
if ("window" in args && args.window) {
|
||||||
|
resolve(args.window);
|
||||||
|
} else {
|
||||||
|
this._recentBrowserWindow().then(browserWin => {
|
||||||
|
resolve(browserWin);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).then(browserWin => {
|
||||||
const userContextId = ("userContextId" in args) ? args.userContextId : 0;
|
const userContextId = ("userContextId" in args) ? args.userContextId : 0;
|
||||||
const source = ("source" in args) ? args.source : null;
|
const source = ("source" in args) ? args.source : null;
|
||||||
const nofocus = ("nofocus" in args) ? args.nofocus : false;
|
const nofocus = ("nofocus" in args) ? args.nofocus : false;
|
||||||
|
@ -1219,7 +1228,8 @@ ContainerWindow.prototype = {
|
||||||
menuItemElement.addEventListener("command", (e) => {
|
menuItemElement.addEventListener("command", (e) => {
|
||||||
ContainerService.openTab({
|
ContainerService.openTab({
|
||||||
userContextId: identity.userContextId,
|
userContextId: identity.userContextId,
|
||||||
source: "tab-bar"
|
source: "tab-bar",
|
||||||
|
window: this._window,
|
||||||
});
|
});
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
@ -1255,7 +1265,8 @@ ContainerWindow.prototype = {
|
||||||
const userContextId = parseInt(e.target.getAttribute("data-usercontextid"), 10);
|
const userContextId = parseInt(e.target.getAttribute("data-usercontextid"), 10);
|
||||||
ContainerService.openTab({
|
ContainerService.openTab({
|
||||||
userContextId: userContextId,
|
userContextId: userContextId,
|
||||||
source: "file-menu"
|
source: "file-menu",
|
||||||
|
window: this._window,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -1265,11 +1276,13 @@ ContainerWindow.prototype = {
|
||||||
const userContextId = parseInt(e.target.getAttribute("data-usercontextid"), 10);
|
const userContextId = parseInt(e.target.getAttribute("data-usercontextid"), 10);
|
||||||
ContainerService.showTabs({
|
ContainerService.showTabs({
|
||||||
userContextId,
|
userContextId,
|
||||||
nofocus: true
|
nofocus: true,
|
||||||
|
window: this._window,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return ContainerService.openTab({
|
return ContainerService.openTab({
|
||||||
userContextId,
|
userContextId,
|
||||||
source: "alltabs-menu"
|
source: "alltabs-menu",
|
||||||
|
window: this._window,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1288,7 +1301,11 @@ ContainerWindow.prototype = {
|
||||||
this._window.gContextMenu.openLinkInTab(e);
|
this._window.gContextMenu.openLinkInTab(e);
|
||||||
|
|
||||||
let userContextId = parseInt(e.target.getAttribute('data-usercontextid'), 10);
|
let userContextId = parseInt(e.target.getAttribute('data-usercontextid'), 10);
|
||||||
ContainerService.showTabs({ userContextId, nofocus: true });
|
ContainerService.showTabs({
|
||||||
|
userContextId,
|
||||||
|
nofocus: true,
|
||||||
|
window: this._window,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue