mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix: dark mode export PDF leaves margin and notification (#2978)
This commit is contained in:
@@ -39,6 +39,13 @@ export async function savePDFFileAs(
|
|||||||
|
|
||||||
await BrowserWindow.getFocusedWindow()
|
await BrowserWindow.getFocusedWindow()
|
||||||
?.webContents.printToPDF({
|
?.webContents.printToPDF({
|
||||||
|
margins: {
|
||||||
|
marginType: 'custom',
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
},
|
||||||
pageSize: 'A4',
|
pageSize: 'A4',
|
||||||
printBackground: true,
|
printBackground: true,
|
||||||
landscape: false,
|
landscape: false,
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ const ExportToPdfMenuItem = ({
|
|||||||
onSelect?.({ type: 'pdf' });
|
onSelect?.({ type: 'pdf' });
|
||||||
setPushNotification({
|
setPushNotification({
|
||||||
key: 'export-to-pdf',
|
key: 'export-to-pdf',
|
||||||
title: 'export',
|
title: t['com.affine.export.success.title'](),
|
||||||
message: 'Export success',
|
message: t['com.affine.export.success.message'](),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -47,8 +47,8 @@ const ExportToPdfMenuItem = ({
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
setPushNotification({
|
setPushNotification({
|
||||||
key: 'export-to-pdf',
|
key: 'export-to-pdf',
|
||||||
title: 'export',
|
title: t['com.affine.export.error.title'](),
|
||||||
message: 'Export error',
|
message: t['com.affine.export.error.message'](),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -63,8 +63,8 @@ const ExportToPdfMenuItem = ({
|
|||||||
onSelect?.({ type: 'pdf' });
|
onSelect?.({ type: 'pdf' });
|
||||||
setPushNotification({
|
setPushNotification({
|
||||||
key: 'export-to-pdf',
|
key: 'export-to-pdf',
|
||||||
title: 'export',
|
title: t['com.affine.export.success.title'](),
|
||||||
message: 'Export success',
|
message: t['com.affine.export.success.message'](),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -72,13 +72,13 @@ const ExportToPdfMenuItem = ({
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
setPushNotification({
|
setPushNotification({
|
||||||
key: 'export-to-pdf',
|
key: 'export-to-pdf',
|
||||||
title: 'export',
|
title: t['com.affine.export.error.title'](),
|
||||||
message: 'Export error',
|
message: t['com.affine.export.error.message'](),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [currentEditor, onSelect, setPushNotification]);
|
}, [currentEditor, onSelect, setPushNotification, t]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
@@ -144,8 +144,8 @@ const ExportToPngMenuItem = ({
|
|||||||
onSelect?.({ type: 'png' });
|
onSelect?.({ type: 'png' });
|
||||||
setPushNotification({
|
setPushNotification({
|
||||||
key: 'export-to-pdf',
|
key: 'export-to-pdf',
|
||||||
title: 'export',
|
title: t['com.affine.export.success.title'](),
|
||||||
message: 'Export success',
|
message: t['com.affine.export.success.message'](),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -153,12 +153,12 @@ const ExportToPngMenuItem = ({
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
setPushNotification({
|
setPushNotification({
|
||||||
key: 'export-to-pdf',
|
key: 'export-to-pdf',
|
||||||
title: 'export',
|
title: t['com.affine.export.error.title'](),
|
||||||
message: 'Export error',
|
message: t['com.affine.export.error.message'](),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, [currentEditor, onSelect, setPushNotification]);
|
}, [currentEditor, onSelect, setPushNotification, t]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -387,5 +387,9 @@
|
|||||||
"Members hint": "Manage members here, invite new member by email.",
|
"Members hint": "Manage members here, invite new member by email.",
|
||||||
"Workspace Settings with name": "{{name}}'s Settings",
|
"Workspace Settings with name": "{{name}}'s Settings",
|
||||||
"com.affine.settings.workspace": "Workspace",
|
"com.affine.settings.workspace": "Workspace",
|
||||||
"com.affine.settings.appearance": "Appearance"
|
"com.affine.settings.appearance": "Appearance",
|
||||||
|
"com.affine.export.success.title": "Exported successfully",
|
||||||
|
"com.affine.export.success.message": "Please open the download folder to check.",
|
||||||
|
"com.affine.export.error.title": "Export failed due to an unexpected error",
|
||||||
|
"com.affine.export.error.message": "Please try it again later."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -388,5 +388,9 @@
|
|||||||
"system": "跟随系统",
|
"system": "跟随系统",
|
||||||
"emptyAllPagesClient": "点击 <1>$t(New Page)</1> 按钮或按 <3>{{shortcut}}</3> 以创建您的第一个页面。",
|
"emptyAllPagesClient": "点击 <1>$t(New Page)</1> 按钮或按 <3>{{shortcut}}</3> 以创建您的第一个页面。",
|
||||||
"frameless": "无边框",
|
"frameless": "无边框",
|
||||||
"Export to PDF": "导出为 PDF"
|
"Export to PDF": "导出为 PDF",
|
||||||
|
"com.affine.export.success.title": "导出成功",
|
||||||
|
"com.affine.export.success.message": "请打开下载的文件夹查看。",
|
||||||
|
"com.affine.export.error.title": "导出失败",
|
||||||
|
"com.affine.export.error.message": "请稍后重试。"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user