mirror of
https://github.com/zadam/trilium.git
synced 2025-12-04 14:34:24 +01:00
fix(share): reference links outside share appear as [missing note]
Some checks are pending
Checks / main (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Dev / Test development (push) Waiting to run
Dev / Build Docker image (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile) (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile.alpine) (push) Blocked by required conditions
/ Check Docker build (Dockerfile) (push) Waiting to run
/ Check Docker build (Dockerfile.alpine) (push) Waiting to run
/ Build Docker images (Dockerfile, ubuntu-24.04-arm, linux/arm64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.alpine, ubuntu-latest, linux/amd64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v7) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v8) (push) Blocked by required conditions
/ Merge manifest lists (push) Blocked by required conditions
playwright / E2E tests on linux-arm64 (push) Waiting to run
playwright / E2E tests on linux-x64 (push) Waiting to run
Some checks are pending
Checks / main (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Dev / Test development (push) Waiting to run
Dev / Build Docker image (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile) (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile.alpine) (push) Blocked by required conditions
/ Check Docker build (Dockerfile) (push) Waiting to run
/ Check Docker build (Dockerfile.alpine) (push) Waiting to run
/ Build Docker images (Dockerfile, ubuntu-24.04-arm, linux/arm64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.alpine, ubuntu-latest, linux/amd64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v7) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v8) (push) Blocked by required conditions
/ Merge manifest lists (push) Blocked by required conditions
playwright / E2E tests on linux-arm64 (push) Waiting to run
playwright / E2E tests on linux-x64 (push) Waiting to run
This commit is contained in:
parent
d5cbf362f8
commit
8b3afc1f49
@ -148,11 +148,8 @@ describe("content_renderer", () => {
|
||||
`
|
||||
});
|
||||
const result = getContent(note);
|
||||
expect(result.content).toStrictEqual(trimIndentation`\
|
||||
<p>
|
||||
<a class="reference-link">[missing note]</a>
|
||||
</p>
|
||||
`);
|
||||
const content = (result.content as string).replaceAll(/\s/g, "");
|
||||
expect(content).toStrictEqual("<p>Foo</p>");
|
||||
});
|
||||
|
||||
it("properly escapes note title", () => {
|
||||
|
||||
@ -320,13 +320,13 @@ function renderText(result: Result, note: SNote | BNote) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (linkEl.classList.contains("reference-link")) {
|
||||
cleanUpReferenceLinks(linkEl, getNote);
|
||||
}
|
||||
|
||||
if (href?.startsWith("#")) {
|
||||
handleAttachmentLink(linkEl, href, getNote, getAttachment);
|
||||
}
|
||||
|
||||
if (linkEl.classList.contains("reference-link")) {
|
||||
cleanUpReferenceLinks(linkEl, getNote);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply syntax highlight.
|
||||
@ -402,8 +402,8 @@ function cleanUpReferenceLinks(linkEl: HTMLElement, getNote: GetNoteFunction) {
|
||||
const noteId = href.split("/").at(-1);
|
||||
const note = noteId ? getNote(noteId) : undefined;
|
||||
if (!note) {
|
||||
console.warn("Unable to find note ", noteId);
|
||||
linkEl.innerHTML = "[missing note]";
|
||||
// If a note is not found, simply replace it with a text.
|
||||
linkEl.replaceWith(new TextNode(linkEl.innerText));
|
||||
} else if (note.isProtected) {
|
||||
linkEl.innerHTML = "[protected]";
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user