Merge pull request #239 from ONLYOFFICE/bugfix/image-editor
Bugfix/image editor
This commit is contained in:
commit
902363529b
@ -43,7 +43,9 @@ const AvatarEditorDialog = (props) => {
|
||||
const { visible, onClose, profile, updateCreatedAvatar, setHasAvatar } =
|
||||
props;
|
||||
const [avatar, setAvatar] = useState({
|
||||
uploadedFile: profile.hasAvatar ? profile.avatarMax : DefaultUserAvatarMax,
|
||||
uploadedFile: profile.hasAvatar
|
||||
? profile.avatarOriginal
|
||||
: DefaultUserAvatarMax,
|
||||
x: 0.5,
|
||||
y: 0.5,
|
||||
zoom: 1,
|
||||
@ -63,7 +65,6 @@ const AvatarEditorDialog = (props) => {
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
|
||||
const file = await dataUrlToFile(preview);
|
||||
|
||||
const avatarData = new FormData();
|
||||
|
@ -84,14 +84,15 @@ class TargetUserStore {
|
||||
};
|
||||
|
||||
updateCreatedAvatar = (avatar) => {
|
||||
const { big, small, medium, max } = avatar;
|
||||
const { big, small, medium, max, main } = avatar;
|
||||
|
||||
this.targetUser.avatar = big;
|
||||
this.targetUser.avatarSmall = small;
|
||||
this.targetUser.avatarMedium = medium;
|
||||
this.targetUser.avatarMax = max;
|
||||
this.targetUser.avatarOriginal = main;
|
||||
|
||||
this.userStore.updateAvatarInfo(big, small, medium, max);
|
||||
this.userStore.updateAvatarInfo(big, small, medium, max, main);
|
||||
|
||||
console.log("updateCreatedAvatar", {
|
||||
targetUser: this.targetUser,
|
||||
@ -138,7 +139,7 @@ class TargetUserStore {
|
||||
isEnableBadges,
|
||||
isEnableRoomsActivity,
|
||||
isEnableDailyFeed,
|
||||
isEnableTips
|
||||
isEnableTips,
|
||||
) => {
|
||||
this.badgesSubscription = isEnableBadges;
|
||||
this.roomsActivitySubscription = isEnableRoomsActivity;
|
||||
|
@ -15,6 +15,7 @@ export type TUser = {
|
||||
workFrom: string;
|
||||
avatarMax: string;
|
||||
avatarMedium: string;
|
||||
avatarOriginal: string;
|
||||
avatar: string;
|
||||
isAdmin: boolean;
|
||||
isRoomAdmin: boolean;
|
||||
|
@ -70,9 +70,12 @@ const Dropzone = ({
|
||||
throw new Error("recursion depth exceeded");
|
||||
}
|
||||
|
||||
return new Promise(() => {
|
||||
resizeRecursiveAsync(img, canvas, compressionRatio + 1, depth + 1);
|
||||
});
|
||||
return new Promise((resolve) => {
|
||||
// eslint-disable-next-line no-promise-executor-return
|
||||
return resolve(file);
|
||||
}).then(() =>
|
||||
resizeRecursiveAsync(img, canvas, compressionRatio + 1, depth + 1),
|
||||
);
|
||||
}
|
||||
|
||||
const onDrop = async ([file]: [File]) => {
|
||||
|
@ -126,6 +126,7 @@ class UserStore {
|
||||
avatarSmall: string,
|
||||
avatarMedium: string,
|
||||
avatarMax: string,
|
||||
avatarOriginal: string,
|
||||
) => {
|
||||
if (this.user) {
|
||||
this.user = {
|
||||
@ -134,6 +135,7 @@ class UserStore {
|
||||
avatarSmall,
|
||||
avatarMedium,
|
||||
avatarMax,
|
||||
avatarOriginal,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user