fix(note_grid): the note grid cannot open the context menu

This commit is contained in:
SiriusXT 2026-01-04 10:25:43 +08:00
parent 7ba8dbbf6e
commit b23252d046
2 changed files with 7 additions and 10 deletions

View File

@ -142,4 +142,10 @@
border: 1px solid var(--main-border-color);
background: var(--more-accented-background-color);
}
.note-list.grid-view .note-path {
margin-left: 0.5em;
vertical-align: middle;
opacity: 0.5;
}
/* #endregion */

View File

@ -103,16 +103,7 @@ function ListNoteCard({ note, parentNote, highlightedTokens, currentLevel, expan
}
function GridNoteCard({ note, parentNote, highlightedTokens }: { note: FNote, parentNote: FNote, highlightedTokens: string[] | null | undefined }) {
const titleRef = useRef<HTMLSpanElement>(null);
const [ noteTitle, setNoteTitle ] = useState<string>();
const notePath = getNotePath(parentNote, note);
const highlightSearch = useImperativeSearchHighlighlighting(highlightedTokens);
useEffect(() => {
tree.getNoteTitle(note.noteId, parentNote.noteId).then(setNoteTitle);
}, [ note ]);
useEffect(() => highlightSearch(titleRef.current), [ noteTitle, highlightedTokens ]);
return (
<div
@ -123,7 +114,7 @@ function GridNoteCard({ note, parentNote, highlightedTokens }: { note: FNote, pa
>
<h5 className="note-book-header">
<Icon className="note-icon" icon={note.getIcon()} />
<span ref={titleRef} className="note-book-title">{noteTitle}</span>
<NoteLink className="note-book-title" notePath={notePath} noPreview showNotePath={parentNote.type === "search"} highlightedTokens={highlightedTokens} />
<NoteAttributes note={note} />
</h5>
<NoteContent