mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-09-30 23:26:39 +08:00
fix: export method
This commit is contained in:
parent
7d446cc7f8
commit
64c7fa9cbf
@ -367,12 +367,12 @@ export function Chat(props: {
|
||||
),
|
||||
actions: [
|
||||
<IconButton
|
||||
key="exportPng"
|
||||
key="exportJpeg"
|
||||
icon={<ExportImage />}
|
||||
bordered
|
||||
text={Locale.Chat.Actions.ExportImage}
|
||||
onClick={() => {
|
||||
dataUrl.current && exportPng(topic, dataUrl.current);
|
||||
dataUrl.current && exportJpeg(topic, dataUrl.current);
|
||||
}}
|
||||
/>,
|
||||
],
|
||||
@ -632,11 +632,13 @@ function showMemoryPrompt(session: ChatSession) {
|
||||
});
|
||||
}
|
||||
|
||||
function exportPng(topic: string, dataURL: string) {
|
||||
const a = document.createElement("a");
|
||||
a.href = dataURL;
|
||||
a.download = `${topic}-${new Date().toLocaleString()}.jpg`;
|
||||
a.click();
|
||||
function exportJpeg(topic: string, dataURL: string) {
|
||||
const link = document.createElement("a");
|
||||
link.href = dataURL;
|
||||
link.download = `${topic}-${new Date().toLocaleString()}.jpg`;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
|
||||
const useHasHydrated = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user