{"size": 1218, "ext": "js", "max_stars_repo_path": "app/javascript/components/emotion_register_form.js", "max_stars_repo_name": "hirorocky/focus", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/javascript/components/emotion_register_form.js", "max_issues_repo_name": "hirorocky/focus", "max_issues_repo_issues_event_min_datetime": "2019-05-31T04:23:09.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T23:54:56.000Z", "max_forks_repo_path": "app/javascript/components/emotion_register_form.js", "max_forks_repo_name": "hirorocky/focus", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 31, "max_forks_count": null, "avg_line_length": 22.5555555556, "max_line_length": 53, "alphanum_fraction": 0.5361247947}
import ColorPickr from './color_pickr.vue'

export default {
  components: {
    ColorPickr
  },
  data: function () {
    return {
      fragments: [],
      recent_id: -1,
      input_content: "",
      input_tag: "",
      input_context: "",
      color: ""
    };
  },
  methods: {
    addFragment: function (event) {
      const tag = this.input_tag;
      const content = this.input_content;
      if (tag !== "" && content !== "") {
        this.fragments.push({
          tag: this.input_tag,
          content: this.input_content,
          id: this.nextId()
        });
        this.input_tag = "";
        this.input_content = "";
      }
    },
    nextId: function () {
      return ++this.recent_id;
    },
    onTagSuggestClicked: function (event) {
      this.input_tag = event.target.text;
    },
    deleteFragment: function (fragment) {
      const index = this.fragments.indexOf(fragment);
      this.fragments.splice(index, 1);
    }
  },
  computed: {
    is_disabled_add_fragment_btn: function () {
      const tag = this.input_tag;
      const content = this.input_content;
      if (tag !== "" && content !== "") {
        return false;
      } else {
        return true;
      }

    }
  }
}