Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#2706 from kfear1337/bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa authored Aug 26, 2023
2 parents b3fd56c + f65b012 commit e009ea5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/components/exporter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export function PreviewActions(props: {
function ExportAvatar(props: { avatar: string }) {
if (props.avatar === DEFAULT_MASK_AVATAR) {
return (
<NextImage
<img
src={BotIcon.src}
width={30}
height={30}
Expand All @@ -393,7 +393,7 @@ function ExportAvatar(props: { avatar: string }) {
);
}

return <Avatar avatar={props.avatar}></Avatar>;
return <Avatar avatar={props.avatar} />;
}

export function ImagePreviewer(props: {
Expand Down Expand Up @@ -422,6 +422,7 @@ export function ImagePreviewer(props: {
])
.then(() => {
showToast(Locale.Copy.Success);
refreshPreview();
});
} catch (e) {
console.error("[Copy Image] ", e);
Expand All @@ -447,11 +448,19 @@ export function ImagePreviewer(props: {
link.download = `${props.topic}.png`;
link.href = blob;
link.click();
refreshPreview();
}
})
.catch((e) => console.log("[Export Image] ", e));
};

const refreshPreview = () => {
const dom = previewRef.current;
if (dom) {
dom.innerHTML = dom.innerHTML; // Refresh the content of the preview by resetting its HTML for fix a bug glitching
}
};

return (
<div className={styles["image-previewer"]}>
<PreviewActions
Expand Down

0 comments on commit e009ea5

Please sign in to comment.