Fix the opening of a link from a context menu - issue #327
This commit is contained in:
parent
52ceef8586
commit
82cad13630
1 changed files with 41 additions and 18 deletions
27
index.js
27
index.js
|
@ -1370,7 +1370,8 @@ ContainerWindow.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_configureContextMenu() {
|
_configureContextMenu() {
|
||||||
return this._configureMenu("context-openlinkinusercontext-menu",
|
return Promise.all([
|
||||||
|
this._configureMenu("context-openlinkinusercontext-menu",
|
||||||
() => {
|
() => {
|
||||||
// This userContextId is what we want to exclude.
|
// This userContextId is what we want to exclude.
|
||||||
const tab = modelFor(this._window).tabs.activeTab;
|
const tab = modelFor(this._window).tabs.activeTab;
|
||||||
|
@ -1388,7 +1389,29 @@ ContainerWindow.prototype = {
|
||||||
window: this._window,
|
window: this._window,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
),
|
||||||
|
this._configureContextMenuOpenLink(),
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_configureContextMenuOpenLink() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const self = this;
|
||||||
|
this._window.gSetUserContextIdAndClick = function(event) {
|
||||||
|
const tab = modelFor(self._window).tabs.activeTab;
|
||||||
|
const userContextId = ContainerService._getUserContextIdFromTab(tab);
|
||||||
|
event.target.setAttribute("data-usercontextid", userContextId);
|
||||||
|
self._window.gContextMenu.openLinkInTab(event);
|
||||||
|
};
|
||||||
|
|
||||||
|
let item = this._window.document.getElementById("context-openlinkincontainertab");
|
||||||
|
item.setAttribute("oncommand", "gSetUserContextIdAndClick(event)");
|
||||||
|
|
||||||
|
item = this._window.document.getElementById("context-openlinkintab");
|
||||||
|
item.setAttribute("oncommand", "gSetUserContextIdAndClick(event)");
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// Generic menu configuration.
|
// Generic menu configuration.
|
||||||
|
|
Loading…
Add table
Reference in a new issue