#885 disables move tab to a new window when only one tab is opened
This commit is contained in:
parent
99db192792
commit
dd57158ab5
1 changed files with 20 additions and 7 deletions
|
@ -212,6 +212,11 @@ const Logic = {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async noOfTabs() {
|
||||||
|
const activeTabs = await browser.tabs.query({windowId: browser.windows.WINDOW_ID_CURRENT});
|
||||||
|
return activeTabs.length;
|
||||||
|
},
|
||||||
|
|
||||||
async refreshIdentities() {
|
async refreshIdentities() {
|
||||||
const [identities, state] = await Promise.all([
|
const [identities, state] = await Promise.all([
|
||||||
browser.contextualIdentities.query({}),
|
browser.contextualIdentities.query({}),
|
||||||
|
@ -717,13 +722,21 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
||||||
|
|
||||||
moveTabsEl.parentNode.insertBefore(fragment, moveTabsEl.nextSibling);
|
moveTabsEl.parentNode.insertBefore(fragment, moveTabsEl.nextSibling);
|
||||||
} else {
|
} else {
|
||||||
Logic.addEnterHandler(moveTabsEl, async function () {
|
Logic.noOfTabs().then(result => {
|
||||||
await browser.runtime.sendMessage({
|
if (result === 1) {
|
||||||
method: "moveTabsToWindow",
|
moveTabsEl.classList.remove("clickable");
|
||||||
windowId: browser.windows.WINDOW_ID_CURRENT,
|
} else {
|
||||||
cookieStoreId: Logic.currentIdentity().cookieStoreId,
|
Logic.addEnterHandler(moveTabsEl, async function () {
|
||||||
});
|
await browser.runtime.sendMessage({
|
||||||
window.close();
|
method: "moveTabsToWindow",
|
||||||
|
windowId: browser.windows.WINDOW_ID_CURRENT,
|
||||||
|
cookieStoreId: Logic.currentIdentity().cookieStoreId,
|
||||||
|
});
|
||||||
|
window.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
throw new Error(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue