Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/css/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@
z-index: 9999;
font-size: 13px;
line-height: 1.6;
cursor: move;
cursor: default;
}

/* ============================================================
Expand Down
39 changes: 34 additions & 5 deletions assets/css/github-print.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -152,6 +164,7 @@
margin-bottom: 8pt !important;
orphans: 3 !important;
widows: 3 !important;
color: #000000 !important;
}

/* ========== LISTS OPTIMIZATION ========== */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
13 changes: 13 additions & 0 deletions assets/js/managers/note-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down