From 8a1b29fddc443b89b84234616ea0190c6479ca7d Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Fri, 1 Nov 2024 20:21:16 +0100 Subject: [PATCH] feat(frontend): add basic print functionality Co-authored-by: Philip Molares Signed-off-by: Erik Michelson --- frontend/locales/en.json | 6 +++++ .../renderer-iframe/renderer-iframe.tsx | 5 +++- .../common/renderer-iframe/style.module.scss | 6 +++++ .../editor-page/editor-page-content.tsx | 6 ++++- .../hooks/use-print-keyboard-shortcut.ts | 27 +++++++++++++++++++ .../print-warning/print-warning.tsx | 24 +++++++++++++++++ .../src/components/editor-page/print.scss | 15 +++++++++++ .../editor-page/sidebar/sidebar.tsx | 2 +- .../entries/export-print-sidebar-entry.tsx | 3 ++- .../splitter/split-divider/split-divider.tsx | 2 +- .../editor-page/splitter/splitter.tsx | 10 +++++-- .../editor-page/utils/print-iframe.ts | 16 +++++++++++ .../document/document-markdown-renderer.tsx | 2 +- .../document/markdown-document.module.scss | 7 +++++ 14 files changed, 123 insertions(+), 8 deletions(-) create mode 100644 frontend/src/components/editor-page/hooks/use-print-keyboard-shortcut.ts create mode 100644 frontend/src/components/editor-page/print-warning/print-warning.tsx create mode 100644 frontend/src/components/editor-page/print.scss create mode 100644 frontend/src/components/editor-page/utils/print-iframe.ts diff --git a/frontend/locales/en.json b/frontend/locales/en.json index 3cb91813f..367a44309 100644 --- a/frontend/locales/en.json +++ b/frontend/locales/en.json @@ -971,5 +971,11 @@ "example": "```markdown=12\nline1\n```\n```markdown=+\nline2\n```\n```markdown=\nline3\n```" } } + }, + "print": { + "warning": { + "title": "Warning!", + "text": "To print this note, please use the print button in the export menu in the sidebar. Printing this page directly will not work as expected." + } } } diff --git a/frontend/src/components/common/renderer-iframe/renderer-iframe.tsx b/frontend/src/components/common/renderer-iframe/renderer-iframe.tsx index cf8fe8409..e7b69dfe5 100644 --- a/frontend/src/components/common/renderer-iframe/renderer-iframe.tsx +++ b/frontend/src/components/common/renderer-iframe/renderer-iframe.tsx @@ -177,11 +177,14 @@ export const RendererIframe: React.FC = ({ {!rendererReady && showWaitSpinner && }