Skip to content

TagSpaces is an offline, open source, document manager with tagging support

feat: added support for printing in the electron file menu

Ilian Sapundshievb63def59daf9
diff --git a/src/main/electron-menus.ts b/src/main/electron-menus.ts
index db6a6606b..73c65f572 100644
--- a/src/main/electron-menus.ts
+++ b/src/main/electron-menus.ts
@@ -16,14 +16,10 @@
*
*/
-import { app, Menu, shell } from 'electron';
+import { app, BrowserWindow, Menu, shell } from 'electron';
import Links from '../../assets/links';
export default function buildDesktopMenu(props: any, i18n) {
- function quitApp() {
- app.quit();
- }
-
const templateDefault = [
{
label: i18n.t('file'),
@@ -54,6 +50,19 @@ export default function buildDesktopMenu(props: any, i18n) {
accelerator: 'CmdOrCtrl+o',
click: props.toggleOpenLinkDialog,
},
+ {
+ label: i18n.t('print'),
+ accelerator: 'CmdOrCtrl+p',
+ click: () => {
+ const win = BrowserWindow.getFocusedWindow();
+ if (win) {
+ win.webContents.print({
+ // silent: false,
+ printBackground: false,
+ });
+ }
+ },
+ },
{
type: 'separator',
},
@@ -63,7 +72,7 @@ export default function buildDesktopMenu(props: any, i18n) {
{
label: i18n.t('exitApp'),
accelerator: 'CmdOrCtrl+q',
- click: quitApp,
+ click: () => app.quit(),
},
],
},
diff --git a/src/renderer/app.global.css b/src/renderer/app.global.css
index 04eacf506..eebc2b735 100644
--- a/src/renderer/app.global.css
+++ b/src/renderer/app.global.css
@@ -28,10 +28,19 @@ body {
margin: 0;
}
+/* needed for crepe */
.full-height {
height: 100%;
}
+
+/* needed for crepe */
.mx-auto{
margin-left: auto;
margin-right: auto;
}
+
+@media print {
+ html, body {
+ height: auto;
+ }
+}
\ No newline at end of file