lib/message/uploadbutton.js
function UploadButton(props) {
  var onClick = function onClick() {
    var inputStyle = 'display:block;visibility:hidden;width:0;height:0';
    var input = $('<input style="' + inputStyle + '" type="file" name="somename" size="chars">');
    input.appendTo($('body'));
    input.change(function () {
      console.log('uploading...');
      var files = input[0].files;
      console.log(files);
      var file = files[0];
      input.remove();
      uploadFile(file, function (data, err) {
        if (err) {
          if (_lodash2.default.isFunction(props.onError)) {
            props.onError(err);
          }
          return;
        }
        if (_lodash2.default.isFunction(props.onSuccess)) {
          props.onSuccess(data);
        }
      });
    });
    input.click();
  };
  var btnProps = {
    className: _style2.default.upload_button,
    title: 'Upload files',
    'data-toggle': 'tooltip',
    onMouseDown: onClick
  };
  return _react2.default.createElement(
    'a',
    btnProps,
    _react2.default.createElement('i', { className: 'ion-camera' })
  );
}
function UploadButton(props) {
  var onClick = function onClick() {
    var inputStyle = 'display:block;visibility:hidden;width:0;height:0';
    var input = $('<input style="' + inputStyle + '" type="file" name="somename" size="chars">');
    input.appendTo($('body'));
    input.change(function () {
      console.log('uploading...');
      var files = input[0].files;
      console.log(files);
      var file = files[0];
      input.remove();
      uploadFile(file, function (data, err) {
        if (err) {
          if (_lodash2.default.isFunction(props.onError)) {
            props.onError(err);
          }
          return;
        }
        if (_lodash2.default.isFunction(props.onSuccess)) {
          props.onSuccess(data);
        }
      });
    });
    input.click();
  };
  var btnProps = {
    className: _style2.default.upload_button,
    title: 'Upload files',
    'data-toggle': 'tooltip',
    onMouseDown: onClick
  };
  return _react2.default.createElement(
    'a',
    btnProps,
    _react2.default.createElement('i', { className: 'ion-camera' })
  );
}
function UploadButton ( props ) { var onClick = function onClick ( ) { var inputStyle = 'display:block;visibility:hidden;width:0;height:0' ; var input = $ ( '<input style="' + inputStyle + '" type="file" name="somename" size="chars">' ) ; input . appendTo ( $ ( 'body' ) ) ; input . change ( function ( ) { console . log ( 'uploading...' ) ; var files = input [ 0 ] . files ; console . log ( files ) ; var file = files [ 0 ] ; input . remove ( ) ; uploadFile ( file , function ( data , err ) { if ( err ) { if ( _lodash2 . default . isFunction ( props . onError ) ) { props . onError ( err ) ; } return ; } if ( _lodash2 . default . isFunction ( props . onSuccess ) ) { props . onSuccess ( data ) ; } } ) ; } ) ; input . click ( ) ; } ; var btnProps = { className : _style2 . default . upload_button , title : 'Upload files' , 'data-toggle' : 'tooltip' , onMouseDown : onClick } ; return _react2 . default . createElement ( 'a' , btnProps , _react2 . default . createElement ( 'i' , { className : 'ion-camera' } ) ) ; }
import Upload from 'component-upload';
import Upload from component - upload ;