New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@kfcoding/image-upload

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kfcoding/image-upload

image uploader

latest
Source
npmnpm
Version
0.11.1
Version published
Maintainers
1
Created
Source

image-upload NPM version Dependency Status

An image-uploader based on ant design (https://ant.design/)

preview

Installation

$ npm install --save @canner/image-upload

Usage

import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import ImageUpload from '../src/index';

class Demo extends Component {
  constructor(props) {
    super(props);
    this.showPopup = this.showPopup.bind(this);
    this.closePopup = this.closePopup.bind(this);

    this.state = {
      popup: false
    };
  }

  showPopup() {
    this.setState({
      popup: true
    });
  }

  closePopup() {
    this.setState({
      popup: false
    });
  }

  onChange(value) {
    console.log(value)
  }

  render() {

    return (
      <div>
        <button onClick={this.showPopup}>show edit</button>
        <ImageUpload
          closeEditPopup={this.closePopup}
          editPopup={this.state.popup}
          onChange={this.onChange}
          multiple={true}
        />
      </div>
    );
  }
}

ReactDOM.render(
  <Demo/>
, document.getElementById('root'));

Props

NameTypeDefaultDescription
localestring'en'Set locale
localeMessageslocaleMessages: {[string]: string}see src/locale/en.jsLocale messages
onChange(value: string | Array<string>) => voidnullcalled every change, if multiple to true value is an array.
closeEditPopup() => voidnullcalled when close
editPopupbooleanfalseshould popup show or not
multiplebooleanfalseallow upload multiple images or not.
galleryConfigArray<{name: string, gallery: Array<{ url: string, name: string }>}> | nulldefault value see src/config.jsSetup albums for users to choose, in Gallery tab, disable if set to null.
serviceConfigdepends on servicesundefinedpass image configurations generate from: https://github.com/Canner/image-service-config

Support i18n

This package support i18n, currently support languages:

Usage: import specific locale messages from lib folder, and pass it into localeMessages props.

import zhTWLocale from '@canner/image-upload/lib/locale/zh_tw';

<ImageUpload
  locale="zh"
  localeMessages={zhTWLocale}
  {...otherProps}
/>

Start example server

npm start

License

Apache-2.0 © Canner

FAQs

Package last updated on 07 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts