зеркало из https://github.com/mozilla/email-tabs.git
Merge pull request #69 from mozilla/open-compose-window
Fix #46, open the compose window immediately
This commit is contained in:
Коммит
ec5aaf4ce4
|
@ -1,6 +1,10 @@
|
||||||
browser.runtime.onMessage.addListener((message, source) => {
|
browser.runtime.onMessage.addListener((message, source) => {
|
||||||
if (message.type === "sendEmail") {
|
if (message.type === "sendEmail") {
|
||||||
return sendEmail(message.tabIds);
|
sendEmail(message.tabIds).catch((e) => {
|
||||||
|
console.error("Error sending email:", e, String(e), e.stack);
|
||||||
|
})
|
||||||
|
// Note we don't need the popup to wait for us to send the email, so we return immediately:
|
||||||
|
return Promise.resolve();
|
||||||
} else if (message.type == "copyTabHtml") {
|
} else if (message.type == "copyTabHtml") {
|
||||||
return copyTabHtml(message.tabIds);
|
return copyTabHtml(message.tabIds);
|
||||||
} else if (message.type === "clearSelectionCache") {
|
} else if (message.type === "clearSelectionCache") {
|
||||||
|
@ -45,8 +49,6 @@ async function getTabInfo(tabIds) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendEmail(tabIds) {
|
async function sendEmail(tabIds) {
|
||||||
let tabInfo = await getTabInfo(tabIds);
|
|
||||||
let html = emailTemplates.renderEmail(tabIds.map(id => tabInfo[id]), emailTemplates.Email);
|
|
||||||
let currentTabs = await browser.tabs.query({
|
let currentTabs = await browser.tabs.query({
|
||||||
active: true,
|
active: true,
|
||||||
currentWindow: true,
|
currentWindow: true,
|
||||||
|
@ -66,6 +68,8 @@ async function sendEmail(tabIds) {
|
||||||
loginInterrupt();
|
loginInterrupt();
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
let tabInfo = await getTabInfo(tabIds);
|
||||||
|
let html = emailTemplates.renderEmail(tabIds.map(id => tabInfo[id]), emailTemplates.Email);
|
||||||
await browser.tabs.executeScript(newTab.id, {
|
await browser.tabs.executeScript(newTab.id, {
|
||||||
file: "set-html-email.js",
|
file: "set-html-email.js",
|
||||||
});
|
});
|
||||||
|
|
|
@ -123,9 +123,7 @@ class Page extends React.Component {
|
||||||
type: "sendEmail",
|
type: "sendEmail",
|
||||||
tabIds: sendTabs,
|
tabIds: sendTabs,
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
window.close();
|
||||||
window.close();
|
|
||||||
}, 300);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async copyTabs() {
|
async copyTabs() {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче