import React, { PropTypes, Component } from 'react'; import Formsy from 'formsy-react'; import FRC from 'formsy-react-components'; import Actions from '../../actions.js'; import { Button } from 'react-bootstrap'; import Core from "meteor/nova:core"; const Messages = Core.Messages; const Textarea = FRC.Textarea; class CommentNew extends Component { constructor() { super(); this.submitComment = this.submitComment.bind(this); } submitComment(data) { const parentComment = this.props.parentComment; const component = this; data = { ...data, postId: this.props.postId } if (parentComment) { // replying to a comment data = { ...data, parentCommentId: parentComment._id, // if parent comment has a topLevelCommentId use it; if it doesn't then it *is* the top level comment topLevelCommentId: parentComment.topLevelCommentId || parentComment._id } } Actions.call("comments.new", data, (error, result) => { if (error) { Messages.flash(error.message); } else { if (this.props.submitCallback) { this.props.submitCallback(); } // console.log(component) // component.refs.commentTextarea.reset(); //TODO: why are refs not working? } }); } render() { return (