Skip to content

Commit 8879cec

Browse files
sanbuphyclaude
andcommitted
Drop note hover tooltip, click to view content
Hover tooltip was jarring (dark box on a light page) and popped even when the note had no body. Marks now stay quiet on hover (only a faint background tint as click affordance); clicking opens the existing note editor, which reads the body from React state instead of the dataset. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 8f9c7db commit 8879cec

2 files changed

Lines changed: 4 additions & 34 deletions

File tree

web/src/components/NotebookViewer.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ function setNoteAnchorMarkData(mark, data) {
423423
mark.dataset.sectionId = data.sectionId || ''
424424
mark.dataset.sectionTitle = data.sectionTitle || ''
425425
mark.dataset.noteQuote = data.quote || ''
426-
mark.dataset.noteText = data.text || ''
427426
}
428427

429428
function renderNoteAnchorMark(range, note) {
@@ -433,7 +432,6 @@ function renderNoteAnchorMark(range, note) {
433432
sectionId: note.sectionId,
434433
sectionTitle: note.sectionTitle,
435434
quote: note.quote,
436-
text: note.text || '',
437435
})
438436
mark.appendChild(range.extractContents())
439437
range.insertNode(mark)
@@ -471,7 +469,6 @@ function syncSavedNotes(root, noteList) {
471469
sectionId: note.sectionId,
472470
sectionTitle: note.sectionTitle,
473471
quote: note.quote,
474-
text: note.text || '',
475472
})
476473
return
477474
}
@@ -1403,13 +1400,15 @@ function NotebookViewer({ notebook, meta, loading, isBookmarked, toggleBookmark,
14031400
event.stopPropagation()
14041401
setSelectionToolbar(null)
14051402
window.getSelection()?.removeAllRanges()
1403+
const noteId = noteAnchor.dataset.noteId || null
1404+
const matchedNote = noteId ? currentNotebookNotes.find((n) => n.id === noteId) : null
14061405
const rect = noteAnchor.getBoundingClientRect()
14071406
setNoteEditor({
1408-
noteId: noteAnchor.dataset.noteId || null,
1407+
noteId,
14091408
sectionId: noteAnchor.dataset.sectionId || '',
14101409
sectionTitle: noteAnchor.dataset.sectionTitle || '',
14111410
quote: noteAnchor.dataset.noteQuote || noteAnchor.textContent,
1412-
text: noteAnchor.dataset.noteText || '',
1411+
text: matchedNote?.text || '',
14131412
top: Math.max(80, rect.top - 20),
14141413
left: Math.min(Math.max(rect.left, 80), window.innerWidth - 360),
14151414
})

web/src/styles/index.css

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,28 +1596,6 @@ mark.note-anchor code {
15961596
background: transparent;
15971597
}
15981598

1599-
/* hover 时用 attr() 弹出笔记正文(纯 CSS,省一层 React state) */
1600-
mark.note-anchor[data-note-text]:hover::after,
1601-
mark.note-anchor[data-note-text]:focus-visible::after {
1602-
content: attr(data-note-text);
1603-
position: absolute;
1604-
left: 0;
1605-
bottom: calc(100% + 6px);
1606-
z-index: 90;
1607-
max-width: 320px;
1608-
padding: 8px 12px;
1609-
background: #1d1d1f;
1610-
color: #fff;
1611-
font-size: 13px;
1612-
line-height: 1.5;
1613-
font-weight: 400;
1614-
border-radius: 6px;
1615-
box-shadow: 0 8px 24px rgba(0,0,0,0.18);
1616-
white-space: pre-wrap;
1617-
word-break: break-word;
1618-
pointer-events: none;
1619-
}
1620-
16211599
[data-theme="dark"] mark.note-anchor {
16221600
border-bottom-color: #6ea8ff;
16231601
}
@@ -1627,13 +1605,6 @@ mark.note-anchor[data-note-text]:focus-visible::after {
16271605
background: rgba(110, 168, 255, 0.16);
16281606
}
16291607

1630-
[data-theme="dark"] mark.note-anchor[data-note-text]:hover::after,
1631-
[data-theme="dark"] mark.note-anchor[data-note-text]:focus-visible::after {
1632-
background: #2a2a2e;
1633-
color: #f5f5f7;
1634-
box-shadow: 0 8px 24px rgba(0,0,0,0.5);
1635-
}
1636-
16371608
.highlight-delete-btn {
16381609
position: absolute;
16391610
z-index: 104;

0 commit comments

Comments
 (0)