<commit_before>var $$ = React.createElement;
var Substance = require("substance");
var Surface = Substance.Surface;



// Sub component
var Remark = require("./remark");

// Subjects Panel extension
// ----------------

var RemarksPanel = React.createClass({
  displayName: "Remarks",

  // State relevant things
  // ------------

  childContextTypes: {
    surface: React.PropTypes.object
  },

  getChildContext: function() {
    return {
      surface: this.surface
    };
  },

  componentWillMount: function() {
    this.surface = new Surface(new Surface.FormEditor(this.props.writerCtrl.doc));
    return {};
  },

  componentDidMount: function() {
    this.props.writerCtrl.registerSurface(this.surface, "remarks");
    this.surface.attach(this.getDOMNode());
  },

  componentWillUnmount: function() {
    this.props.writerCtrl.unregisterSurface(this.surface);
    this.surface.detach();
  },


  handleToggle: function(remarkId) {
    var writerCtrl = this.props.writerCtrl;

    if (writerCtrl.state.remarkId === remarkId) {
      writerCtrl.replaceState({
        contextId: "remarks"
      });
    } else {
      writerCtrl.replaceState({
        contextId: "remarks",
        remarkId: remarkId
      });
    }
  },

  // Rendering
  // -------------------

  render: function() {<commit_msg>Tools for remarks.<commit_after>var $$ = React.createElement;
var Substance = require("substance");
var Surface = Substance.Surface;



// Sub component
var Remark = require("./remark");

// Subjects Panel extension
// ----------------

var RemarksPanel = React.createClass({
  displayName: "Remarks",

  // State relevant things
  // ------------

  childContextTypes: {
    surface: React.PropTypes.object
  },

  getChildContext: function() {
    return {
      surface: this.surface
    };
  },

  componentWillMount: function() {
    this.surface = new Surface(new Surface.FormEditor(this.props.writerCtrl.doc));
    return {};
  },

  componentDidMount: function() {
    this.props.writerCtrl.registerSurface(this.surface, "remarks", {
      enabledTools: ["strong", "emphasis"]
    });
    this.surface.attach(this.getDOMNode());
  },

  componentWillUnmount: function() {
    this.props.writerCtrl.unregisterSurface(this.surface);
    this.surface.detach();
  },


  handleToggle: function(remarkId) {
    var writerCtrl = this.props.writerCtrl;

    if (writerCtrl.state.remarkId === remarkId) {
      writerCtrl.replaceState({
        contextId: "remarks"
      });
    } else {
      writerCtrl.replaceState({
        contextId: "remarks",
        remarkId: remarkId
      });
    }
  },

  // Rendering
  // -------------------

  render: function() {
{'fraction_non_alphanumeric': 0.16860247283626825, 'fraction_numerical': 0.0, 'mean_word_length': 2.622795115332429, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1550821', 'n_tokens_mistral': 795, 'n_tokens_neox': 763, 'n_words': 141}