<commit_before>import FileUploadComponent from 'appkit/components/file-upload';

export default FileUploadComponent.extend({
  selectAccept: 'image/*',
  defaultClasses: 'icon-picture',
  successMsg    : ' Image upload complete.',

  valueChanged: function () {
    if (!this.get('control.value')) {
      this.$('.wy-form-upload-image').remove();
    }
  }.observes('control.value'),

  willInsertElement: function () {
    this.set('initial', this.get('control.value'));
  },

  beforeUpload: function (file) {
    this.$container.show();
    this.$url.hide();
    this.$uploadBtn.hide();
    this.$loading.css('display', 'inline-block');

    this.set('initial', null);

    this.$('.wy-form-upload-image').remove();

    var image = Ember.$('<div class="wy-form-upload-image">');

    Ember.$('<img>').attr({
      src: (window.URL || window.webkitURL).createObjectURL(file)
    }).appendTo(image);

    image.prependTo(this.$upload);

  }
});<commit_msg>NOT SURE IF I FIXED THIS RIGHT, DONT KILL ME MIKE<commit_after>import FileUploadComponent from 'appkit/components/file-upload';

export default FileUploadComponent.extend({
  selectAccept: 'image/*',
  defaultClasses: 'icon-picture',
  successMsg    : ' Image upload complete.',

  valueChanged: function () {
    if (!this.get('control.value')) {
      this.$('.wy-form-upload-image').remove();
    }
  }.observes('control.value'),

  willInsertElement: function () {
    this.set('initial', this.get('control.value'));
  },

  beforeUpload: function (file) {
    this.$container.show();
    this.$url.hide();
    this.$uploadBtn.hide();
    this.$loading.css('display', 'inline-block');

    this.set('initial', null);

    this.$('.wy-form-upload-image').remove();

    var image = Ember.$('<div class="wy-form-upload-image">');

    // TEMPORARY HACK, FOR WHEN FILE IS NOT A FILE BUT A URL (URL UPLOAD)
    if(typeof file === "string") {
      Ember.$('<img>').attr({
        src: file
      }).appendTo(image);
    } else {
      console.log(file);
      Ember.$('<img>').attr({
        src: (window.URL || window.webkitURL).createObjectURL(file)
      }).appendTo(image);
    }

    image.prependTo(this.$upload);

  }
});
{'fraction_non_alphanumeric': 0.1934156378600823, 'fraction_numerical': 0.0, 'mean_word_length': 3.393574297188755, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '6061768', 'n_tokens_mistral': 701, 'n_tokens_neox': 677, 'n_words': 125}