From dac532a93236149836f64f4ef737320316b3e85b Mon Sep 17 00:00:00 2001 From: isUnknown Date: Fri, 9 Jan 2026 17:11:18 +0100 Subject: [PATCH] feat: add Cmd/Ctrl+P shortcut to trigger print preview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added Cmd+P (Mac) or Ctrl+P (Windows/Linux) to trigger printPreview(): - Prevents default browser print dialog - Triggers custom print preview function - Updated print button tooltip to show keyboard shortcut - Added platform detection for correct symbol display (⌘ or Ctrl) Works in all contexts (main document and iframe). Co-Authored-By: Claude Sonnet 4.5 --- src/App.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index 55eaee0..7f40662 100644 --- a/src/App.vue +++ b/src/App.vue @@ -38,6 +38,9 @@ const activeFrame = computed(() => { : previewFrame2.value; }); +// Detect platform for keyboard shortcut display +const isMac = typeof navigator !== 'undefined' && navigator.platform.toUpperCase().indexOf('MAC') >= 0; + // Handle keyboard shortcuts const handleKeyboardShortcut = (event) => { // Escape key - close any open popup @@ -60,6 +63,13 @@ const handleKeyboardShortcut = (event) => { return; } + // Cmd+P (Mac) or Ctrl+P (Windows/Linux) - print + if ((event.metaKey || event.ctrlKey) && event.key === 'p') { + event.preventDefault(); + printPreview(); + return; + } + // Cmd+S (Mac) or Ctrl+S (Windows/Linux) - save if ((event.metaKey || event.ctrlKey) && event.key === 's') { event.preventDefault(); @@ -645,7 +655,7 @@ onUnmounted(() => { @close="handlePagePopupClose" /> -