@etsoo/materialui 1.4.32 → 1.4.33
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.
|
@@ -8,7 +8,7 @@ export interface UserAvatarEditorToBlob {
|
|
|
8
8
|
* User avatar editor on done handler
|
|
9
9
|
*/
|
|
10
10
|
export interface UserAvatarEditorOnDoneHandler {
|
|
11
|
-
(canvas: HTMLCanvasElement, toBlob: UserAvatarEditorToBlob, type: string): Promise<void |
|
|
11
|
+
(canvas: HTMLCanvasElement, toBlob: UserAvatarEditorToBlob, type: string): Promise<void | true | undefined>;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* User avatar editor props
|
package/lib/UserAvatarEditor.js
CHANGED
|
@@ -102,6 +102,7 @@ export function UserAvatarEditor(props) {
|
|
|
102
102
|
setEditorState({ ...defaultState });
|
|
103
103
|
};
|
|
104
104
|
const resetUI = () => {
|
|
105
|
+
setReady(false);
|
|
105
106
|
setPreviewImage(undefined);
|
|
106
107
|
handleReset();
|
|
107
108
|
};
|
|
@@ -144,13 +145,13 @@ export function UserAvatarEditor(props) {
|
|
|
144
145
|
unsharpThreshold: 1
|
|
145
146
|
});
|
|
146
147
|
const result = await onDone(canvas, toBlob, type.current);
|
|
147
|
-
if (result
|
|
148
|
+
if (result) {
|
|
148
149
|
resetUI();
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
else {
|
|
152
153
|
const result = await onDone(data, toBlob, type.current);
|
|
153
|
-
if (result
|
|
154
|
+
if (result) {
|
|
154
155
|
resetUI();
|
|
155
156
|
}
|
|
156
157
|
}
|
package/package.json
CHANGED
package/src/UserAvatarEditor.tsx
CHANGED
|
@@ -40,7 +40,7 @@ export interface UserAvatarEditorOnDoneHandler {
|
|
|
40
40
|
canvas: HTMLCanvasElement,
|
|
41
41
|
toBlob: UserAvatarEditorToBlob,
|
|
42
42
|
type: string
|
|
43
|
-
): Promise<void |
|
|
43
|
+
): Promise<void | true | undefined>;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -230,6 +230,7 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
|
|
|
230
230
|
};
|
|
231
231
|
|
|
232
232
|
const resetUI = () => {
|
|
233
|
+
setReady(false);
|
|
233
234
|
setPreviewImage(undefined);
|
|
234
235
|
handleReset();
|
|
235
236
|
};
|
|
@@ -283,12 +284,12 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
|
|
|
283
284
|
});
|
|
284
285
|
|
|
285
286
|
const result = await onDone(canvas, toBlob, type.current);
|
|
286
|
-
if (result
|
|
287
|
+
if (result) {
|
|
287
288
|
resetUI();
|
|
288
289
|
}
|
|
289
290
|
} else {
|
|
290
291
|
const result = await onDone(data, toBlob, type.current);
|
|
291
|
-
if (result
|
|
292
|
+
if (result) {
|
|
292
293
|
resetUI();
|
|
293
294
|
}
|
|
294
295
|
}
|