@antscorp/antsomi-ui 1.3.5-beta.280 → 1.3.5-beta.281
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.
|
@@ -93,23 +93,26 @@ export const ImageSlider = props => {
|
|
|
93
93
|
var _a;
|
|
94
94
|
(_a = fileRef === null || fileRef === void 0 ? void 0 : fileRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
95
95
|
}, []);
|
|
96
|
-
const onImportImageSelect = (e) => {
|
|
96
|
+
const onImportImageSelect = useCallback((e) => {
|
|
97
97
|
var _a, _b, _c;
|
|
98
98
|
if ((_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0]) {
|
|
99
99
|
if (((_b = e.target.files) === null || _b === void 0 ? void 0 : _b[0].size) > SIZE_LIMIT) {
|
|
100
|
-
|
|
100
|
+
/**
|
|
101
|
+
* NOTE: This reset e.target.files (fix: upload the same image later will trigger change input)
|
|
102
|
+
* use DataTransfer because e.target.files = null not work in this case
|
|
103
|
+
*/
|
|
104
|
+
e.target.files = new DataTransfer().files;
|
|
101
105
|
message.error({
|
|
102
106
|
content: 'File size too big',
|
|
103
107
|
style: { fontSize: '11px', fontFamily: 'Roboto' },
|
|
104
108
|
});
|
|
105
|
-
e.target.files = null;
|
|
106
109
|
return;
|
|
107
110
|
}
|
|
108
111
|
(_c = imageResizeRef.current) === null || _c === void 0 ? void 0 : _c.replaceImageWithUrl(URL.createObjectURL(e.target.files[0]));
|
|
109
112
|
setUploadThumbnail(undefined);
|
|
110
113
|
}
|
|
111
|
-
e.target.files =
|
|
112
|
-
};
|
|
114
|
+
e.target.files = new DataTransfer().files;
|
|
115
|
+
}, []);
|
|
113
116
|
useDropFile('.image-upload-zone', e => {
|
|
114
117
|
var _a, _b, _c, _d;
|
|
115
118
|
if (!((_a = e === null || e === void 0 ? void 0 : e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files[0]))
|
|
@@ -143,16 +146,9 @@ export const ImageSlider = props => {
|
|
|
143
146
|
const ImageResizeComponent = useFabric ? ImageResizeTuiEditor : ImageResize;
|
|
144
147
|
return (React.createElement(ImageSliderStyled, { className: className || '', "$skeleton": showSkeletonMemo, "$imageWidth": imageWidth, "$smallImageWidth": smallImageWidth, "$imageHeight": imageHeight, vertical: true, gap: 10 },
|
|
145
148
|
React.createElement(Flex, { vertical: true, style: { zIndex: 25, display: !isNil(currentEditing) ? 'flex' : 'none' }, className: `edit-thumbnail-container ${!isNil(currentEditing) ? 'is-editing' : ''}` },
|
|
146
|
-
React.createElement(ImageResizeComponent, {
|
|
147
|
-
// latestCanvas && isEditPrevious
|
|
148
|
-
(latestCanvas === null || latestCanvas === void 0 ? void 0 : latestCanvas[currentEditing])
|
|
149
|
+
React.createElement(ImageResizeComponent, { className: `image-resize-wrapper ${typeof uploadThumbnail === 'number' ? 'visibility-hidden' : ''}`, width: imageWidth, height: imageHeight, ref: imageResizeRef, hideAction: true, imageUrl: (latestCanvas === null || latestCanvas === void 0 ? void 0 : latestCanvas[currentEditing])
|
|
149
150
|
? undefined
|
|
150
|
-
: getUrlNoCache(currentThumbnailUrl, timeGenerated),
|
|
151
|
-
// imageUrl={getUrlNoCache(
|
|
152
|
-
// thumbnails[editingThumbnail ?? (uploadThumbnail as number)],
|
|
153
|
-
// timeGenerated,
|
|
154
|
-
// )}
|
|
155
|
-
defaultValue: latestCanvas === null || latestCanvas === void 0 ? void 0 : latestCanvas[currentEditing] }),
|
|
151
|
+
: getUrlNoCache(currentThumbnailUrl, timeGenerated), defaultValue: latestCanvas === null || latestCanvas === void 0 ? void 0 : latestCanvas[currentEditing] }),
|
|
156
152
|
typeof uploadThumbnail !== 'number' ? null : (React.createElement(Flex, { className: `image-upload-zone ${!showSkeletonMemo ? 'hide-skeleton' : ''}` },
|
|
157
153
|
React.createElement(Icon, { type: "icon-ants-upload-fill", style: { fontSize: '40px' } }),
|
|
158
154
|
React.createElement(Flex, { vertical: true, align: "flex-start" },
|
|
@@ -47,6 +47,10 @@ export const ImageSliderStyled = styled(Flex) `
|
|
|
47
47
|
background-size: 90% 90%;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
.image-resize-wrapper.visibility-hidden {
|
|
51
|
+
visibility: hidden;
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
.image-resize-wrapper,
|
|
51
55
|
.image-upload-zone {
|
|
52
56
|
border: 1px solid ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.blue1_1};
|