react-cropper
Advanced tools
Comparing version 0.1.6 to 0.1.7
'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var React = require('react'); | ||
@@ -72,2 +74,11 @@ var $ = require('jquery'); | ||
componentWillUnmount: function componentWillUnmount() { | ||
if (this.$img) { | ||
// Destroy the cropper, this makes sure events such as resize are cleaned up and do not leak | ||
this.$img.cropper('destroy'); | ||
// While we're at it remove our reference to the jQuery instance | ||
delete this.$img; | ||
} | ||
}, | ||
move: function move(offsetX, offsetY) { | ||
@@ -105,6 +116,2 @@ return this.$img.cropper('move', offsetX, offsetY); | ||
destroy: function destroy() { | ||
return this.$img.cropper('destroy'); | ||
}, | ||
getData: function getData() { | ||
@@ -157,3 +164,3 @@ return this.$img.cropper('getData'); | ||
'div', | ||
this.props, | ||
_extends({}, this.props, { src: null }), | ||
React.createElement('img', { | ||
@@ -170,2 +177,2 @@ crossOrigin: 'anonymous', | ||
module.exports = Cropper; | ||
module.exports = Cropper; |
{ | ||
"name": "react-cropper", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "", | ||
@@ -12,3 +12,3 @@ "main": "dist/react-cropper.js", | ||
"prebuild": "npm run lint", | ||
"example": "webpack example/index.jsx --config example/webpack.config.js" | ||
"example": "webpack example/index.jsx --config example/webpack.config.js --output-path example/assets" | ||
}, | ||
@@ -33,7 +33,7 @@ "author": "Fong Kuanghuei <waneblade@gmail.com>", | ||
"cropper": "^0.9.3", | ||
"jquery": "^2.1.4" | ||
"jquery": "^1.11.3 || ^2.1.4" | ||
}, | ||
"peerDependencies": { | ||
"react": ">= 0.12.0, < 0.14.0", | ||
"jquery": "^2.1.4" | ||
"react": ">= 0.12.0 || =0.14.0-alpha3", | ||
"jquery": "^1.11.3 || ^2.1.4" | ||
}, | ||
@@ -44,3 +44,3 @@ "devDependencies": { | ||
"css-loader": "^0.12.0", | ||
"eslint": "^0.20.0", | ||
"eslint": "^0.23.0", | ||
"eslint-plugin-react": "^2.2.0", | ||
@@ -53,4 +53,3 @@ "extract-text-webpack-plugin": "^0.7.1", | ||
"load-grunt-tasks": "^3.1.0", | ||
"react": ">= 0.12.0, < 0.14.0", | ||
"react-tools": "^0.13.2", | ||
"react": ">= 0.12.0", | ||
"style-loader": "^0.12.1", | ||
@@ -57,0 +56,0 @@ "webpack": "^1.8.11" |
# [react-cropper](http://roadmanfong.github.io/react-cropper/) | ||
Cropper as React components | ||
[![NPM](https://nodei.co/npm/react-cropper.png?downloads=true)](https://www.npmjs.com/package/react-cropper) | ||
[Cropper](https://github.com/fengyuanchen/cropper) as React components | ||
[Demo](http://roadmanfong.github.io/react-cropper/example/) | ||
@@ -14,13 +17,32 @@ | ||
``` | ||
```shell | ||
npm install --save react-cropper | ||
``` | ||
### Webpack User | ||
You also need a couple of loaders for webpack | ||
``` | ||
```shell | ||
npm install style-loader css-loader | ||
``` | ||
### Browserify User | ||
https://github.com/cheton/browserify-css | ||
```shell | ||
npm i --save-dev browserify-css | ||
``` | ||
Compile your project with command line like | ||
```shell | ||
browserify -t reactify -g browserify-css index.jsx > bundle.js | ||
``` | ||
## Todo | ||
* Unit test | ||
* Put demo in [http://roadmanfong.github.io/react-cropper/](http://roadmanfong.github.io/react-cropper/) | ||
## Quick Example | ||
@@ -27,0 +49,0 @@ ```js |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
14
142
0
1
11220
7
142
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedreact@18.3.1(transitive)
- Removedacorn@5.7.4(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedast-types@0.9.6(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbase62@1.2.8(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcommander@2.20.3(transitive)
- Removedcommoner@0.10.8(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddefined@1.0.1(transitive)
- Removeddetective@4.7.1(transitive)
- Removedenvify@3.4.1(transitive)
- Removedesprima@3.1.3(transitive)
- Removedesprima-fb@15001.1.0-dev-harmony-fb(transitive)
- Removedglob@5.0.15(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjstransform@11.0.3(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedobject-assign@2.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedprivate@0.1.8(transitive)
- Removedq@1.5.1(transitive)
- Removedreact@0.13.3(transitive)
- Removedrecast@0.11.23(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsource-map@0.4.40.5.7(transitive)
- Removedthrough@2.3.8(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedjquery@^1.11.3 || ^2.1.4