<commit_before>import React, { Component, PropTypes } from 'react';
import $ from 'jquery';
import { autobind } from 'core-decorators';
import { render } from 'react-dom';
import { insertTextIntoEditor } from '../common/editor';
import EmotionPicker from './EmotionPicker';
import StickerPicker from './StickerPicker';
import { getChromeLocalStore, setChromeLocalStore } from '../utils/settings';

function addUserId(content, authInfo) {
  const url = `https://${authInfo.userId}`;
  if (content.indexOf(url) > -1) return content;
  return `${content}[IMG]${url}[/IMG]`;
}

function insertUserId($editor, authInfo) {
  const content = $editor.val();
  const updatedContent = addUserId(content, authInfo);
  if (updatedContent === content) return;
  $editor.val(updatedContent);
}

@autobind
class EmotionControl extends Component {
  static propTypes = {
    emotionHelper: PropTypes.bool,
    currentView: PropTypes.string,
    stickerPanelExpand: PropTypes.bool,
  }

  constructor(comProps) {
    super(comProps);
    this.editor = null;
    this.updateEmotionHelper(comProps);
  }

  componentWillReceiveProps(nextProps) {
    this.updateEmotionHelper(nextProps);
  }

  onIconClick(emotion) {
    if (this.editor) {
      insertTextIntoEditor(emotion.text, this.editor);
    }
  }

  onStickerClick(sticker) {
    if (this.editor && sticker.url) {
      const bbcode = `[IMG]${sticker.url}[/IMG]`;
      insertTextIntoEditor(bbcode, this.editor);
    }
  }

  updateEmotionHelper(nextProps = this.props) {
    const { emotionHelper, currentView, stickerPanelExpand } = nextProps;<commit_msg>chỉnh sửa tính năng thêm id<commit_after>import React, { Component, PropTypes } from 'react';
import $ from 'jquery';
import { autobind } from 'core-decorators';
import { render } from 'react-dom';
import { insertTextIntoEditor } from '../common/editor';
import EmotionPicker from './EmotionPicker';
import StickerPicker from './StickerPicker';
import { getChromeLocalStore, setChromeLocalStore } from '../utils/settings';

function addUserId(content, authInfo) {
  const url = `https://${authInfo.userId}`;
  if (content.indexOf(url) > -1) return content;
  return `${content}[URL="${url}"][/URL]`;
}

function insertUserId($editor, authInfo) {
  const content = $editor.val();
  const updatedContent = addUserId(content, authInfo);
  if (updatedContent === content) return;
  $editor.val(updatedContent);
}

@autobind
class EmotionControl extends Component {
  static propTypes = {
    emotionHelper: PropTypes.bool,
    currentView: PropTypes.string,
    stickerPanelExpand: PropTypes.bool,
  }

  constructor(comProps) {
    super(comProps);
    this.editor = null;
    this.updateEmotionHelper(comProps);
  }

  componentWillReceiveProps(nextProps) {
    this.updateEmotionHelper(nextProps);
  }

  onIconClick(emotion) {
    if (this.editor) {
      insertTextIntoEditor(emotion.text, this.editor);
    }
  }

  onStickerClick(sticker) {
    if (this.editor && sticker.url) {
      const bbcode = `[URL="${sticker.url}"][/URL]`;
      insertTextIntoEditor(bbcode, this.editor);
    }
  }

  updateEmotionHelper(nextProps = this.props) {
    const { emotionHelper, currentView, stickerPanelExpand } = nextProps;
{'fraction_non_alphanumeric': 0.13449564134495642, 'fraction_numerical': 0.0006226650062266501, 'mean_word_length': 4.427364864864865, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '4205734', 'n_tokens_mistral': 1015, 'n_tokens_neox': 1017, 'n_words': 210}