mirror of
https://github.com/zadam/trilium.git
synced 2025-12-05 06:54:23 +01:00
Compare commits
3 Commits
c7c1985ff8
...
fc67404edf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc67404edf | ||
|
|
2985bd0a1c | ||
|
|
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 {
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/// <reference types="../../../../node_modules/dayjs/plugin/advancedFormat.d.ts" />
|
||||
/// <reference types="../../../../node_modules/dayjs/plugin/duration.d.ts" />
|
||||
/// <reference types="../../../../node_modules/dayjs/plugin/isBetween.d.ts" />
|
||||
/// <reference types="../../../../node_modules/dayjs/plugin/isoWeek.d.ts" />
|
||||
/// <reference types="../../../../node_modules/dayjs/plugin/isSameOrAfter.d.ts" />
|
||||
/// <reference types="../../../../node_modules/dayjs/plugin/isSameOrBefore.d.ts" />
|
||||
/// <reference types="../../../../node_modules/dayjs/plugin/quarterOfYear.d.ts" />
|
||||
/// <reference types="../../../../node_modules/dayjs/plugin/utc.d.ts" />
|
||||
|
||||
import { LOCALES } from "./i18n.js";
|
||||
import { DAYJS_LOADER, dayjs } from "./dayjs.js";
|
||||
|
||||
|
||||
@ -1,5 +1,14 @@
|
||||
import { default as dayjs, type Dayjs } from "dayjs";
|
||||
|
||||
import "dayjs/plugin/advancedFormat";
|
||||
import "dayjs/plugin/duration";
|
||||
import "dayjs/plugin/isBetween";
|
||||
import "dayjs/plugin/isoWeek";
|
||||
import "dayjs/plugin/isSameOrAfter";
|
||||
import "dayjs/plugin/isSameOrBefore";
|
||||
import "dayjs/plugin/quarterOfYear";
|
||||
import "dayjs/plugin/utc";
|
||||
|
||||
//#region Plugins
|
||||
import advancedFormat from "dayjs/plugin/advancedFormat.js";
|
||||
import duration from "dayjs/plugin/duration.js";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user