Always open the windowed standalone UI when invoked from the contextual menu (thanks ZeroUnderscoreOu for reporting).
This commit is contained in:
parent
b203b73898
commit
b65a48d719
|
@ -126,7 +126,7 @@
|
||||||
toggleCtxMenuItem();
|
toggleCtxMenuItem();
|
||||||
browser.contextMenus.onClicked.addListener((info, tab) => {
|
browser.contextMenus.onClicked.addListener((info, tab) => {
|
||||||
if (info.menuItemId == ctxMenuId) {
|
if (info.menuItemId == ctxMenuId) {
|
||||||
this.openPageUI();
|
messageHandler.openStandalonePopup(tab);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -196,23 +196,24 @@
|
||||||
ns.computeChildPolicy)(...arguments);
|
ns.computeChildPolicy)(...arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
async openStandalonePopup() {
|
async openStandalonePopup(tab) {
|
||||||
let [tab] = (await browser.tabs.query({
|
if (!tab) tab = (await browser.tabs.query({
|
||||||
currentWindow: true,
|
currentWindow: true,
|
||||||
active: true
|
active: true
|
||||||
}));
|
}))[0];
|
||||||
|
|
||||||
if (!tab || tab.id === -1) {
|
if (!tab || tab.id === -1) {
|
||||||
log("No tab found to open the UI for");
|
log("No tab found to open the UI for");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let win = await browser.windows.getCurrent();
|
let win = await browser.windows.get(tab.windowId);
|
||||||
|
let width = 610, height = 400;
|
||||||
browser.windows.create({
|
browser.windows.create({
|
||||||
url: popupFor(tab.id),
|
url: popupFor(tab.id),
|
||||||
width: 800,
|
width,
|
||||||
height: 600,
|
height,
|
||||||
top: win.top + 48,
|
top: win.top + Math.round((win.height - height) / 2),
|
||||||
left: win.left + 48,
|
left: win.left + Math.round((win.width - width) / 2),
|
||||||
type: "panel"
|
type: "panel"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue