use correct active tab URL

This commit is contained in:
zadam 2020-10-09 23:08:57 +02:00
parent 097d319fca
commit 89984a7d96

View File

@ -1,16 +1,16 @@
// Keyboard shortcuts
chrome.commands.onCommand.addListener(async function (command) {
if(command=="saveSelection") {
if (command == "saveSelection") {
await saveSelection();
} else if (command == "saveWholePage") {
await saveWholePage();
} else if (command == "saveScreenshot") {
const activeTab = await getActiveTab();
await saveScreenshot(activeTab);
await saveScreenshot(activeTab.url);
} else {
console.log("Unrecognized command", command);
}
});
function cropImage(newArea, dataUrl) {
@ -323,7 +323,9 @@ browser.runtime.onMessage.addListener(async request => {
return await browser.tabs.executeScript({file: request.file});
}
else if (request.name === 'save-screenshot') {
return await saveScreenshot();
const activeTab = await getActiveTab();
return await saveScreenshot(activeTab.url);
}
else if (request.name === 'save-whole-page') {
return await saveWholePage();