froala / angular-froala

Angular.js bindings for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
MIT License
306 stars 123 forks source link

In Firefox, I am not able to upload image by using froala editor using angular4 #184

Closed rameshpraja closed 6 years ago

rameshpraja commented 6 years ago

Technology : Angular4 In Firefox, When I upload images by Froala editor then its throwing some error in console. I am using Angular4 But In chrome its working fine.

I am using below mention version in my Angular4 application Froala version : angular-froala-wysiwyg": "^2.8.4"

Error in console are : ReferenceError: event is not defined[Learn More] File : export class BlobUploader{ public static options: Object = { charCounterCount: true, fileUpload: false, videoUpload: false, events : { 'froalaEditor.image.beforeUpload': function (e, editor, files) { alert(files);

    if (files.length) {
    var image=(<HTMLInputElement>event.target).files[0];
    if(image.size<65000){
      var reader = new FileReader();

      reader.onload = function (e) {

        var result = reader.result
        editor.image.insert(result, null, null, editor.image.get());
      };

      reader.readAsDataURL(files[0]);
    }
    else{
      alert('Image Size Exceeded threshold value <br> Please upload an image of smaller size!')
    }
    }
  return false;
  },
}

}; } Please team help me how to fixed that issue.

stefanneculai commented 6 years ago

It looks like you should use e.target instead of event.target.