aboutsummaryrefslogtreecommitdiff
path: root/src/background.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/background.ts')
-rw-r--r--src/background.ts20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/background.ts b/src/background.ts
index 997dd68..48d51a7 100644
--- a/src/background.ts
+++ b/src/background.ts
@@ -1,21 +1,4 @@
-type Identity = {
- id?: string;
- email?: string;
- name?: string;
-};
-
-type ComposeContext = {
- account: Identity;
- compose: {
- subject?: string;
- to?: string[];
- cc?: string[];
- bcc?: string[];
- bodyPlain?: string;
- bodyHTML?: string;
- identityId?: string;
- };
-};
+import { ComposeContext } from "./types";
async function getComposeContext(): Promise<ComposeContext> {
const data: ComposeContext = { account: {}, compose: {} };
@@ -34,6 +17,7 @@ async function getComposeContext(): Promise<ComposeContext> {
data.compose.identityId = details?.identityId ?? undefined;
data.compose.bodyPlain = details?.plainTextBody ?? "";
data.compose.bodyHTML = details?.body ?? "";
+ data.compose.isHtml = Boolean(details?.body && details?.body.trim());
const accounts: any[] = (browser as any).accounts?.list
? await (browser as any).accounts.list()