mirror of
https://github.com/zadam/trilium.git
synced 2025-12-04 14:34:24 +01:00
Merge branch 'TriliumNext:main' into main
This commit is contained in:
commit
975e8487fc
@ -148,11 +148,8 @@ describe("content_renderer", () => {
|
|||||||
`
|
`
|
||||||
});
|
});
|
||||||
const result = getContent(note);
|
const result = getContent(note);
|
||||||
expect(result.content).toStrictEqual(trimIndentation`\
|
const content = (result.content as string).replaceAll(/\s/g, "");
|
||||||
<p>
|
expect(content).toStrictEqual("<p>Foo</p>");
|
||||||
<a class="reference-link">[missing note]</a>
|
|
||||||
</p>
|
|
||||||
`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("properly escapes note title", () => {
|
it("properly escapes note title", () => {
|
||||||
|
|||||||
@ -320,13 +320,13 @@ function renderText(result: Result, note: SNote | BNote) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linkEl.classList.contains("reference-link")) {
|
|
||||||
cleanUpReferenceLinks(linkEl, getNote);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (href?.startsWith("#")) {
|
if (href?.startsWith("#")) {
|
||||||
handleAttachmentLink(linkEl, href, getNote, getAttachment);
|
handleAttachmentLink(linkEl, href, getNote, getAttachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (linkEl.classList.contains("reference-link")) {
|
||||||
|
cleanUpReferenceLinks(linkEl, getNote);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply syntax highlight.
|
// Apply syntax highlight.
|
||||||
@ -402,8 +402,8 @@ function cleanUpReferenceLinks(linkEl: HTMLElement, getNote: GetNoteFunction) {
|
|||||||
const noteId = href.split("/").at(-1);
|
const noteId = href.split("/").at(-1);
|
||||||
const note = noteId ? getNote(noteId) : undefined;
|
const note = noteId ? getNote(noteId) : undefined;
|
||||||
if (!note) {
|
if (!note) {
|
||||||
console.warn("Unable to find note ", noteId);
|
// If a note is not found, simply replace it with a text.
|
||||||
linkEl.innerHTML = "[missing note]";
|
linkEl.replaceWith(new TextNode(linkEl.innerText));
|
||||||
} else if (note.isProtected) {
|
} else if (note.isProtected) {
|
||||||
linkEl.innerHTML = "[protected]";
|
linkEl.innerHTML = "[protected]";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user