mirror of
https://github.com/lencx/ChatGPT.git
synced 2026-02-06 11:47:08 +00:00
fix: export.js
This commit is contained in:
parent
76c10e3662
commit
2d18d7f457
6
scripts/export.js
vendored
6
scripts/export.js
vendored
@ -168,13 +168,13 @@ async function exportInit() {
|
|||||||
await invoke('download_list', { pathname: 'chat.notes.json', filename, id, dir: 'notes' });
|
await invoke('download_list', { pathname: 'chat.notes.json', filename, id, dir: 'notes' });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function downloadThread({ asF = Format.PNG } = {}) {
|
async function downloadThread({ as = Format.PNG } = {}) {
|
||||||
const { startLoading, stopLoading } = new window.__LoadingMask('Exporting in progress...');
|
const { startLoading, stopLoading } = new window.__LoadingMask('Exporting in progress...');
|
||||||
startLoading();
|
startLoading();
|
||||||
const elements = new Elements();
|
const elements = new Elements();
|
||||||
await elements.fixLocation();
|
await elements.fixLocation();
|
||||||
const pixelRatio = window.devicePixelRatio;
|
const pixelRatio = window.devicePixelRatio;
|
||||||
const minRatio = asF === Format.PDF ? 2 : 2.5;
|
const minRatio = as === Format.PDF ? 2 : 2.5;
|
||||||
window.devicePixelRatio = Math.max(pixelRatio, minRatio);
|
window.devicePixelRatio = Math.max(pixelRatio, minRatio);
|
||||||
|
|
||||||
html2canvas(elements.thread, {
|
html2canvas(elements.thread, {
|
||||||
@ -185,7 +185,7 @@ async function exportInit() {
|
|||||||
window.devicePixelRatio = pixelRatio;
|
window.devicePixelRatio = pixelRatio;
|
||||||
const imgData = canvas.toDataURL('image/png');
|
const imgData = canvas.toDataURL('image/png');
|
||||||
requestAnimationFrame(async () => {
|
requestAnimationFrame(async () => {
|
||||||
if (asF === Format.PDF) {
|
if (as === Format.PDF) {
|
||||||
await handlePdf(imgData, canvas, pixelRatio);
|
await handlePdf(imgData, canvas, pixelRatio);
|
||||||
} else {
|
} else {
|
||||||
await handleImg(imgData);
|
await handleImg(imgData);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user