mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
Support for both htmlBody and original body
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user