Support for both htmlBody and original body

This commit is contained in:
okbel
2018-02-21 16:37:19 -03:00
parent 9cfa5b6a0f
commit bf1bae8999
11 changed files with 216 additions and 16 deletions
+13
View File
@@ -0,0 +1,13 @@
const TurndownService = require('turndown');
module.exports = {
RootMutation: {
createComment: {
async pre(_, { input }, _context, _info) {
// Saving the HTML comment as Markdown
const ts = new TurndownService();
input.body = ts.turndown(input.body);
},
},
},
};
@@ -0,0 +1,7 @@
const marked = require('marked');
module.exports = {
Comment: {
body: comment => marked(comment.body),
},
};
@@ -0,0 +1,7 @@
input CreateCommentInput {
htmlBody: String
}
type Comment {
htmlBody: String
}