mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-04 07:10:06 +08:00
17 lines
557 B
CoffeeScript
17 lines
557 B
CoffeeScript
marked = require 'marked'
|
|
Utils = require './utils'
|
|
{ComposerExtension} = require 'mailspring-exports'
|
|
|
|
rawBodies = {}
|
|
|
|
class MarkdownComposerExtension extends ComposerExtension
|
|
|
|
@applyTransformsForSending: ({draftBodyRootNode, draft}) ->
|
|
rawBodies[draft.id] = draftBodyRootNode.innerHTML
|
|
draftBodyRootNode.innerHTML = marked(draftBodyRootNode.innerText)
|
|
|
|
@unapplyTransformsForSending: ({draftBodyRootNode, draft}) ->
|
|
if rawBodies[draft.id]
|
|
draftBodyRootNode.innerHTML = rawBodies[draft.id]
|
|
|
|
module.exports = MarkdownComposerExtension
|