getMailBody method added. see #237
This commit is contained in:
parent
c39d68d859
commit
5fbead1fcc
1 changed files with 23 additions and 0 deletions
|
|
@ -83,6 +83,29 @@ export async function getMailSubject(tab){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getMailBody(fullMessage){
|
||||||
|
let text = '';
|
||||||
|
let html = '';
|
||||||
|
|
||||||
|
if (fullMessage.contentType.trim().toLowerCase() === "text/plain") {
|
||||||
|
text = fullMessage.body;
|
||||||
|
}
|
||||||
|
if (fullMessage.contentType.trim().toLowerCase() === "text/html") {
|
||||||
|
html = fullMessage.body;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let part of fullMessage.parts) {
|
||||||
|
if (part.contentType.trim().toLowerCase() === "text/plain") {
|
||||||
|
text = part.body;
|
||||||
|
}
|
||||||
|
if (part.contentType.trim().toLowerCase() === "text/html") {
|
||||||
|
html = part.body;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {text, html};
|
||||||
|
}
|
||||||
|
|
||||||
export async function reloadBody(tabId){
|
export async function reloadBody(tabId){
|
||||||
let composeDetails = await messenger.compose.getComposeDetails(tabId);
|
let composeDetails = await messenger.compose.getComposeDetails(tabId);
|
||||||
let originalHtmlBody = composeDetails.body + " ";
|
let originalHtmlBody = composeDetails.body + " ";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue