From 764f4a077cdc8ffb0dfc98ac0a48301c12be6561 Mon Sep 17 00:00:00 2001 From: kookyleo Date: Wed, 29 Oct 2025 00:27:22 +0800 Subject: [PATCH 1/2] Update print styles: reset heading-section position and improve page break control --- assets/css/github-print.css | 39 ++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/assets/css/github-print.css b/assets/css/github-print.css index 222cb9d..c8ce48a 100644 --- a/assets/css/github-print.css +++ b/assets/css/github-print.css @@ -53,13 +53,19 @@ text-shadow: none !important; } - /* Page setup with optimized margins */ + /* Page setup with optimized margins and page numbers */ @page { margin-top: 1.5cm; margin-right: 1.5cm; - margin-bottom: 1.5cm; + margin-bottom: 2cm; margin-left: 1.5cm; size: A4; + + @bottom-center { + content: counter(page) " / " counter(pages); + font-size: 10pt; + color: #666; + } } html, body { @@ -101,6 +107,12 @@ font-size: 12pt !important; line-height: 1.4 !important; background: transparent !important; + color: #000000 !important; + } + + /* Force black text color on all elements except specific exceptions */ + .markdown-body * { + color: #000000 !important; } /* Headings optimization */ @@ -152,6 +164,7 @@ margin-bottom: 8pt !important; orphans: 3 !important; widows: 3 !important; + color: #000000 !important; } /* ========== LISTS OPTIMIZATION ========== */ @@ -291,7 +304,7 @@ text-decoration: underline !important; } - /* Print URLs after links */ + /* Print URLs after links - keep gray color */ .markdown-body a[href]:after { content: " (" attr(href) ")" !important; font-size: 9pt !important; @@ -344,6 +357,21 @@ } /* ========== PAGE BREAK CONTROL ========== */ + /* Allow page breaks in heading sections to prevent blank pages */ + .heading-section { + page-break-inside: auto !important; + break-inside: auto !important; + position: static !important; + padding: 0 !important; + margin: 0 !important; + } + + /* Ensure all container divs allow page breaks */ + .markdown-body div { + page-break-inside: auto !important; + break-inside: auto !important; + } + .markdown-body h1, .markdown-body h2 { page-break-before: auto !important; @@ -552,8 +580,9 @@ border-bottom: 1pt solid rgba(218, 165, 32, 0.6) !important; } - /* Strikethrough */ - .strikethrough { + /* Strikethrough - keep gray color */ + .strikethrough, + .strikethrough * { text-decoration: line-through !important; color: #666 !important; } From 3e1b87aebb0db42afe39923dfb3d225f4a89f2b2 Mon Sep 17 00:00:00 2001 From: kookyleo Date: Wed, 29 Oct 2025 00:38:13 +0800 Subject: [PATCH 2/2] Fix note-popup UI issues - Change cursor from move to default for note-popup - Add click-outside-to-close functionality for note-popup - Ensure popup closes when edit button is clicked --- assets/css/editor.css | 2 +- assets/js/main.js | 4 ++++ assets/js/managers/note-manager.js | 13 +++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/assets/css/editor.css b/assets/css/editor.css index 30f5c89..4b519af 100644 --- a/assets/css/editor.css +++ b/assets/css/editor.css @@ -485,7 +485,7 @@ z-index: 9999; font-size: 13px; line-height: 1.6; - cursor: move; + cursor: default; } /* ============================================================ diff --git a/assets/js/main.js b/assets/js/main.js index 05d2396..c82c9b5 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -553,6 +553,10 @@ export class MarkonApp { const annotationId = e.target.dataset.annotationId; const annotation = this.#annotationManager.getById(annotationId); if (annotation) { + // 关闭 note-popup + const popup = document.querySelector('.note-popup'); + if (popup) popup.remove(); + const highlightElement = this.#markdownBody.querySelector(`[data-annotation-id="${annotationId}"]`); if (highlightElement) { const range = document.createRange(); diff --git a/assets/js/managers/note-manager.js b/assets/js/managers/note-manager.js index f30ab52..e48ee45 100644 --- a/assets/js/managers/note-manager.js +++ b/assets/js/managers/note-manager.js @@ -211,6 +211,19 @@ export class NoteManager { document.body.appendChild(popup); + // 添加点击外部关闭功能 + const closeHandler = (e) => { + if (!popup.contains(e.target) && !noteData.highlightElement.contains(e.target)) { + popup.remove(); + document.removeEventListener('click', closeHandler); + Logger.log('NoteManager', 'Note popup closed by clicking outside'); + } + }; + // 延迟添加事件监听器,避免立即触发 + setTimeout(() => { + document.addEventListener('click', closeHandler); + }, 0); + // 调整位置以保持在视口内 const popupRect = popup.getBoundingClientRect(); if (popupRect.right > window.innerWidth) {