antd-img-crop 4.5.0 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/antd-img-crop.cjs.js +2 -2
- package/dist/antd-img-crop.d.ts +1 -1
- package/dist/antd-img-crop.esm.js +2 -2
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -61,17 +61,17 @@ const Demo = () => (
|
|
|
61
61
|
| onUploadFail | `function` | - | Call when upload failed |
|
|
62
62
|
| cropperProps | `object` | - | Props of [react-easy-crop] (\* [existing props] cannot be overridden) |
|
|
63
63
|
|
|
64
|
-
##
|
|
64
|
+
## Before antd v5
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
### No style?
|
|
67
|
+
|
|
68
|
+
If you use `babel-plugin-import` and no `Modal` or `Slider` were imported, please import the styles manually:
|
|
67
69
|
|
|
68
70
|
```js
|
|
69
71
|
import 'antd/es/modal/style';
|
|
70
72
|
import 'antd/es/slider/style';
|
|
71
73
|
```
|
|
72
74
|
|
|
73
|
-
## FAQ
|
|
74
|
-
|
|
75
75
|
### ConfigProvider not work?
|
|
76
76
|
|
|
77
77
|
If using `craco-antd`, please try to add `libraryDirectory: 'es'` to `craco.config.js`:
|
package/README.zh-CN.md
CHANGED
|
@@ -61,17 +61,17 @@ const Demo = () => (
|
|
|
61
61
|
| onUploadFail | `function` | - | 上传失败时的回调 |
|
|
62
62
|
| cropperProps | `object` | - | [react-easy-crop] 的 props(\* [已有 props] 无法重写) |
|
|
63
63
|
|
|
64
|
-
##
|
|
64
|
+
## 在 antd v5 之前
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
### 没有样式?
|
|
67
|
+
|
|
68
|
+
若项目使用 `babel-plugin-import` 且未引入 `Modal` 或 `Slider`,请手动引入样式:
|
|
67
69
|
|
|
68
70
|
```js
|
|
69
71
|
import 'antd/es/modal/style';
|
|
70
72
|
import 'antd/es/slider/style';
|
|
71
73
|
```
|
|
72
74
|
|
|
73
|
-
## FAQ
|
|
74
|
-
|
|
75
75
|
### ConfigProvider 未生效?
|
|
76
76
|
|
|
77
77
|
若使用 `craco-antd`,请在 `craco.config.js` 中添加 `libraryDirectory: 'es'`:
|
|
@@ -203,9 +203,9 @@ const ImgCrop = react.forwardRef((props, cropperRef) => {
|
|
|
203
203
|
ctx.drawImage(imgSource, cropX, cropY, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight);
|
|
204
204
|
}
|
|
205
205
|
// get the new image
|
|
206
|
-
const { type, name, uid
|
|
206
|
+
const { type, name, uid } = fileRef.current;
|
|
207
207
|
canvas.toBlob((blob) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
208
|
-
const newFile = Object.assign(new File([blob], name, { type }), { uid
|
|
208
|
+
const newFile = Object.assign(new File([blob], name, { type }), { uid });
|
|
209
209
|
if (!beforeUploadRef.current) {
|
|
210
210
|
return resolveRef.current(newFile);
|
|
211
211
|
}
|
package/dist/antd-img-crop.d.ts
CHANGED
|
@@ -199,9 +199,9 @@ const ImgCrop = forwardRef((props, cropperRef) => {
|
|
|
199
199
|
ctx.drawImage(imgSource, cropX, cropY, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight);
|
|
200
200
|
}
|
|
201
201
|
// get the new image
|
|
202
|
-
const { type, name, uid
|
|
202
|
+
const { type, name, uid } = fileRef.current;
|
|
203
203
|
canvas.toBlob((blob) => __awaiter(void 0, void 0, void 0, function* () {
|
|
204
|
-
const newFile = Object.assign(new File([blob], name, { type }), { uid
|
|
204
|
+
const newFile = Object.assign(new File([blob], name, { type }), { uid });
|
|
205
205
|
if (!beforeUploadRef.current) {
|
|
206
206
|
return resolveRef.current(newFile);
|
|
207
207
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-img-crop",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.2",
|
|
4
4
|
"description": "An image cropper for Ant Design Upload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -34,26 +34,27 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@rollup/plugin-replace": "^5.0.1",
|
|
37
|
-
"@rollup/plugin-typescript": "^
|
|
38
|
-
"@trivago/prettier-plugin-sort-imports": "^
|
|
39
|
-
"@types/node": "^18.11.
|
|
37
|
+
"@rollup/plugin-typescript": "^10.0.1",
|
|
38
|
+
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
|
|
39
|
+
"@types/node": "^18.11.10",
|
|
40
40
|
"@types/react": "^18.0.25",
|
|
41
41
|
"@types/react-dom": "^18.0.9",
|
|
42
42
|
"@types/rollup-plugin-less": "^1.1.2",
|
|
43
|
-
"
|
|
43
|
+
"@vitejs/plugin-react": "^2.2.0",
|
|
44
|
+
"antd": "^5.0.3",
|
|
44
45
|
"eslint": "^8.28.0",
|
|
45
46
|
"eslint-config-prettier": "^8.5.0",
|
|
46
47
|
"eslint-config-react-app": "^7.0.1",
|
|
47
|
-
"prettier": "^2.
|
|
48
|
+
"prettier": "^2.8.0",
|
|
48
49
|
"react": "^18.2.0",
|
|
49
50
|
"react-dom": "^18.2.0",
|
|
50
|
-
"rollup": "3.
|
|
51
|
+
"rollup": "3.5.1",
|
|
51
52
|
"rollup-plugin-dts": "^5.0.0",
|
|
52
53
|
"rollup-plugin-less": "^1.1.3",
|
|
53
|
-
"typescript": "^4.9.3"
|
|
54
|
+
"typescript": "^4.9.3",
|
|
55
|
+
"vite": "^3.2.4"
|
|
54
56
|
},
|
|
55
57
|
"scripts": {
|
|
56
|
-
"
|
|
57
|
-
"build": "rm -rf dist && rollup -c --configPlugin @rollup/plugin-typescript"
|
|
58
|
+
"build": "rollup -c --configPlugin @rollup/plugin-typescript"
|
|
58
59
|
}
|
|
59
60
|
}
|