Fix shortcut triggered for real active tab (#345)
This commit is contained in:
parent
45f83116f6
commit
46b1a33e1d
|
@ -43,13 +43,13 @@ export const onCommandListener = async command => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const translateSelectedText = async () => {
|
const translateSelectedText = async () => {
|
||||||
const tab = (await browser.tabs.query({ active: true }))[0];
|
const tab = (await browser.tabs.query({ active: true, currentWindow: true }))[0];
|
||||||
browser.tabs.sendMessage(tab.id, {
|
browser.tabs.sendMessage(tab.id, {
|
||||||
message: "translateSelectedText"
|
message: "translateSelectedText"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const translatePage = async () => {
|
const translatePage = async () => {
|
||||||
const tab = (await browser.tabs.query({ active: true }))[0];
|
const tab = (await browser.tabs.query({ active: true, currentWindow: true }))[0];
|
||||||
const tabUrl = await browser.tabs.sendMessage(tab.id, { message: "getTabUrl" });
|
const tabUrl = await browser.tabs.sendMessage(tab.id, { message: "getTabUrl" });
|
||||||
|
|
||||||
const targetLang = getSettings("targetLang");
|
const targetLang = getSettings("targetLang");
|
||||||
|
|
Loading…
Reference in a new issue