diff --git a/adapters/mail/src/message.ts b/adapters/mail/src/message.ts index 98b1ec0f..3e962e95 100644 --- a/adapters/mail/src/message.ts +++ b/adapters/mail/src/message.ts @@ -39,40 +39,21 @@ export class MailMessageEncoder extends MessageEncoder { const { type, attrs, children } = element if (type === 'text') { this.buffer += attrs.content - } else if (type === 'b' || type === 'strong') { - this.buffer += '' + } else if (['b', 'strong', 'i', 'em', 'u', 'ins', 's', 'del', 'p', 'code', 'li', 'ul', 'ol', 'blockquote'].includes(type)) { + this.buffer += `<${type}>` await this.render(children) - this.buffer += '' - } else if (type === 'i' || type === 'em') { - this.buffer += '' - await this.render(children) - this.buffer += '' - } else if (type === 'u' || type === 'ins') { - this.buffer += '' - await this.render(children) - this.buffer += '' - } else if (type === 's' || type === 'del') { - this.buffer += '' - await this.render(children) - this.buffer += '' - } else if (type === 'code') { - this.buffer += '' - await this.render(children) - this.buffer += '' + this.buffer += `` } else if (type === 'a') { this.buffer += `` await this.render(children) this.buffer += `` - } else if (type === 'p') { - await this.render(children) - this.buffer += `\n` } else if (type === 'at') { if (attrs.id) { this.buffer += `@${attrs.id}` } } else if (type === 'sharp' && attrs.id) { this.buffer += ` #${attrs.id} ` - } else if (type === 'image' && attrs.url) { + } else if (['image', 'audio', 'video', 'file'].includes(type) && attrs.url) { let url: string if (attrs.url.match(/^https?:/)) { url = attrs.url @@ -87,7 +68,13 @@ export class MailMessageEncoder extends MessageEncoder { }) url = `cid:${cid}` } - this.buffer += `` + if (type === 'image') { + this.buffer += `` + } else if (type === 'audio') { + this.buffer += `