antd-img-crop 4.16.0 → 4.17.0
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.
|
@@ -179,15 +179,16 @@ const ImgCrop = react.forwardRef((props, cropperRef) => {
|
|
|
179
179
|
const onCancel = react.useRef();
|
|
180
180
|
const onOk = react.useRef();
|
|
181
181
|
const runRawBeforeUpload = react.useCallback((beforeUpload, file, pass, fail) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
182
|
+
const rawFile = file;
|
|
182
183
|
if (typeof beforeUpload !== 'function') {
|
|
183
|
-
pass(
|
|
184
|
+
pass(rawFile);
|
|
184
185
|
return;
|
|
185
186
|
}
|
|
186
187
|
try {
|
|
187
188
|
// https://ant.design/components/upload-cn#api
|
|
188
189
|
// https://github.com/ant-design/ant-design/blob/master/components/upload/Upload.tsx#L152-L178
|
|
189
190
|
const result = yield beforeUpload(file, [file]);
|
|
190
|
-
pass(result !== true ? result :
|
|
191
|
+
pass(result !== true ? result : rawFile);
|
|
191
192
|
}
|
|
192
193
|
catch (err) {
|
|
193
194
|
fail(err);
|
|
@@ -177,15 +177,16 @@ const ImgCrop = forwardRef((props, cropperRef) => {
|
|
|
177
177
|
const onCancel = useRef();
|
|
178
178
|
const onOk = useRef();
|
|
179
179
|
const runRawBeforeUpload = useCallback((beforeUpload, file, pass, fail) => __awaiter(void 0, void 0, void 0, function* () {
|
|
180
|
+
const rawFile = file;
|
|
180
181
|
if (typeof beforeUpload !== 'function') {
|
|
181
|
-
pass(
|
|
182
|
+
pass(rawFile);
|
|
182
183
|
return;
|
|
183
184
|
}
|
|
184
185
|
try {
|
|
185
186
|
// https://ant.design/components/upload-cn#api
|
|
186
187
|
// https://github.com/ant-design/ant-design/blob/master/components/upload/Upload.tsx#L152-L178
|
|
187
188
|
const result = yield beforeUpload(file, [file]);
|
|
188
|
-
pass(result !== true ? result :
|
|
189
|
+
pass(result !== true ? result : rawFile);
|
|
189
190
|
}
|
|
190
191
|
catch (err) {
|
|
191
192
|
fail(err);
|