The context menu must be recreated each time we change tab - issue #289

This commit is contained in:
baku 2017-02-28 18:39:34 +01:00
parent d66c3b8576
commit 9806087e98

View file

@ -228,15 +228,16 @@ const ContainerService = {
tabs.on("activate", tab => { tabs.on("activate", tab => {
this._hideAllPanels(); this._hideAllPanels();
this._restyleActiveTab(tab).catch(() => {}); this._restyleActiveTab(tab).catch(() => {});
this._configureActiveWindows();
this._remapTab(tab); this._remapTab(tab);
}); });
// Modify CSS and other stuff for each window. // Modify CSS and other stuff for each window.
this.configureWindows().catch(() => {}); this._configureWindows().catch(() => {});
windows.browserWindows.on("open", window => { windows.browserWindows.on("open", window => {
this.configureWindow(viewFor(window)).catch(() => {}); this._configureWindow(viewFor(window)).catch(() => {});
}); });
windows.browserWindows.on("close", window => { windows.browserWindows.on("close", window => {
@ -934,18 +935,30 @@ const ContainerService = {
// Styling the window // Styling the window
configureWindows() { _configureWindows() {
const promises = []; const promises = [];
for (let window of windows.browserWindows) { // eslint-disable-line prefer-const for (let window of windows.browserWindows) { // eslint-disable-line prefer-const
promises.push(this.configureWindow(viewFor(window))); promises.push(this._configureWindow(viewFor(window)));
} }
return Promise.all(promises); return Promise.all(promises);
}, },
configureWindow(window) { _configureWindow(window) {
return this._getOrCreateContainerWindow(window).configure(); return this._getOrCreateContainerWindow(window).configure();
}, },
_configureActiveWindows() {
const promises = [];
for (let window of windows.browserWindows) { // eslint-disable-line prefer-const
promises.push(this._configureActiveWindow(viewFor(window)));
}
return Promise.all(promises);
},
_configureActiveWindow(window) {
return this._getOrCreateContainerWindow(window).configureActive();
},
closeWindow(window) { closeWindow(window) {
this._windowMap.delete(window); this._windowMap.delete(window);
}, },
@ -1136,11 +1149,15 @@ ContainerWindow.prototype = {
this._configureActiveTab(), this._configureActiveTab(),
this._configureFileMenu(), this._configureFileMenu(),
this._configureAllTabsMenu(), this._configureAllTabsMenu(),
this._configureContextMenu(),
this._configureTabStyle(), this._configureTabStyle(),
this.configureActive(),
]); ]);
}, },
configureActive() {
return this._configureContextMenu();
},
handleEvent(e) { handleEvent(e) {
let el = e.target; let el = e.target;
switch (e.type) { switch (e.type) {