mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 09:45:52 +01:00
fix(collections/list): children are displayed twice for empty notes (closes #7301)
This commit is contained in:
@@ -79,7 +79,7 @@ function ListNoteCard({ note, parentNote, expand, highlightedTokens }: { note: F
|
||||
</h5>
|
||||
|
||||
{isExpanded && <>
|
||||
<NoteContent note={note} highlightedTokens={highlightedTokens} />
|
||||
<NoteContent note={note} highlightedTokens={highlightedTokens} noChildrenList />
|
||||
<NoteChildren note={note} parentNote={parentNote} highlightedTokens={highlightedTokens} />
|
||||
</>}
|
||||
</div>
|
||||
@@ -110,7 +110,11 @@ function GridNoteCard({ note, parentNote, highlightedTokens }: { note: FNote, pa
|
||||
<span ref={titleRef} className="note-book-title">{noteTitle}</span>
|
||||
<NoteAttributes note={note} />
|
||||
</h5>
|
||||
<NoteContent note={note} trim highlightedTokens={highlightedTokens} />
|
||||
<NoteContent
|
||||
note={note}
|
||||
trim
|
||||
highlightedTokens={highlightedTokens}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -126,12 +130,15 @@ function NoteAttributes({ note }: { note: FNote }) {
|
||||
return <span className="note-list-attributes" ref={ref} />
|
||||
}
|
||||
|
||||
function NoteContent({ note, trim, highlightedTokens }: { note: FNote, trim?: boolean, highlightedTokens }) {
|
||||
function NoteContent({ note, trim, noChildrenList, highlightedTokens }: { note: FNote, trim?: boolean, noChildrenList?: boolean, highlightedTokens: string[] | null | undefined }) {
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
const highlightSearch = useImperativeSearchHighlighlighting(highlightedTokens);
|
||||
|
||||
useEffect(() => {
|
||||
content_renderer.getRenderedContent(note, { trim })
|
||||
content_renderer.getRenderedContent(note, {
|
||||
trim,
|
||||
noChildrenList
|
||||
})
|
||||
.then(({ $renderedContent, type }) => {
|
||||
if (!contentRef.current) return;
|
||||
contentRef.current.replaceChildren(...$renderedContent);
|
||||
|
||||
Reference in New Issue
Block a user