Merge pull request #239 from ONLYOFFICE/bugfix/image-editor

Bugfix/image editor
This commit is contained in:
Alexey Safronov 2024-02-08 15:04:55 +04:00 committed by GitHub
commit 902363529b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 8 deletions

View File

@ -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();

View File

@ -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;

View File

@ -15,6 +15,7 @@ export type TUser = {
workFrom: string;
avatarMax: string;
avatarMedium: string;
avatarOriginal: string;
avatar: string;
isAdmin: boolean;
isRoomAdmin: boolean;

View File

@ -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]) => {

View 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,
};
}
};