Compare commits

..

15 Commits

Author SHA1 Message Date
Jakob Schlanstedt
37a9893409
Merge 8ee59e9daa9629c7e568847b811c8e22aa3bdfad into 8b3afc1f4925dfa46ac781473c5f5716e3c6e118 2025-12-03 21:23:19 +01:00
Elian Doran
8b3afc1f49
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
2025-12-03 22:22:10 +02:00
Elian Doran
d5cbf362f8
test(client): fix typecheck issue 2025-12-03 22:04:39 +02:00
Elian Doran
286a8626d1
Translations update from Hosted Weblate (#7928) 2025-12-03 17:54:26 +00:00
Elian Doran
aa62dc3f32
Translated using Weblate (Romanian)
Currently translated at 100.0% (1636 of 1636 strings)

Translation: Trilium Notes/Client
Translate-URL: https://hosted.weblate.org/projects/trilium/client/ro/
2025-12-03 17:52:47 +00:00
Elian Doran
045e7977d5
fix(map): markers disappearing due to infinite map 2025-12-03 19:51:01 +02:00
Elian Doran
e0dc25ad23
fix(print): fails if included note could not be found 2025-12-03 19:16:58 +02:00
Elian Doran
9d0499a306
fix(note_actions): print disabled not reacting to note type changes 2025-12-03 19:06:20 +02:00
Elian Doran
b971e002ce
chore(tree_context_menu): clarify "Convert to attachment" message 2025-12-03 18:56:49 +02:00
Elian Doran
5fd488e210
feat(tree_context_menu): disable "Convert to attachment" if no eligible notes 2025-12-03 18:55:10 +02:00
Elian Doran
eb84da4c51
fix(code): too much padding 2025-12-03 18:47:14 +02:00
Elian Doran
49243148a2
fix(note_list): note list shown when switching types (e.g. for mindmap) 2025-12-03 18:40:24 +02:00
Elian Doran
276241cdff
style(attachment): basic attachment card design 2025-12-03 18:29:49 +02:00
Elian Doran
6772453b3a
fix(attachment): duplicate padding in code blocks 2025-12-03 18:23:31 +02:00
Elian Doran
18e2f1f90c
fix(attachment): attachment content overlapping 2025-12-03 18:22:52 +02:00
18 changed files with 84 additions and 39 deletions

View File

@ -240,7 +240,7 @@ export default class FNote {
const aNote = this.froca.getNoteFromCache(aNoteId);
if (aNote.isArchived || aNote.isHiddenCompletely()) {
if (!aNote || aNote.isArchived || aNote.isHiddenCompletely()) {
return 1;
}

View File

@ -140,7 +140,13 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
uiIcon: "bx bx-rename",
enabled: isNotRoot && parentNotSearch && notOptionsOrHelp
},
{ title: t("tree-context-menu.convert-to-attachment"), command: "convertNoteToAttachment", uiIcon: "bx bx-paperclip", enabled: isNotRoot && !isHoisted && notOptionsOrHelp },
{
title:
t("tree-context-menu.convert-to-attachment"),
command: "convertNoteToAttachment",
uiIcon: "bx bx-paperclip",
enabled: isNotRoot && !isHoisted && notOptionsOrHelp && selectedNotes.some(note => note.isEligibleForConversionToAttachment())
},
{ kind: "separator" },

View File

@ -56,9 +56,14 @@ async function renderIncludedNotes(contentEl: HTMLElement) {
// Render and integrate the notes.
for (const includeNoteEl of includeNoteEls) {
const noteId = includeNoteEl.getAttribute("data-note-id");
if (!noteId) return;
if (!noteId) continue;
const note = froca.getNoteFromCache(noteId);
if (!note) {
console.warn(`Unable to include ${noteId} because it could not be found.`);
continue;
}
const renderedContent = (await content_renderer.getRenderedContent(note)).$renderedContent;
includeNoteEl.replaceChildren(...renderedContent);
}

View File

@ -13,7 +13,7 @@ export interface Froca {
getBlob(entityType: string, entityId: string): Promise<FBlob | null>;
getNote(noteId: string, silentNotFoundError?: boolean): Promise<FNote | null>;
getNoteFromCache(noteId: string): FNote;
getNoteFromCache(noteId: string): FNote | undefined;
getNotesFromCache(noteIds: string[], silentNotFoundError?: boolean): FNote[];
getNotes(noteIds: string[], silentNotFoundError?: boolean): Promise<FNote[]>;

View File

@ -288,7 +288,7 @@ class FrocaImpl implements Froca {
return (await this.getNotes([noteId], silentNotFoundError))[0];
}
getNoteFromCache(noteId: string) {
getNoteFromCache(noteId: string): FNote | undefined {
if (!noteId) {
throw new Error("Empty noteId");
}

View File

@ -1633,7 +1633,7 @@
"import-into-note": "Import into note",
"apply-bulk-actions": "Apply bulk actions",
"converted-to-attachments": "{{count}} notes have been converted to attachments.",
"convert-to-attachment-confirm": "Are you sure you want to convert note selected notes into attachments of their parent notes?",
"convert-to-attachment-confirm": "Are you sure you want to convert the selected notes into attachments of their parent notes? This operation only applies to Image notes, other notes will be skipped.",
"open-in-popup": "Quick edit"
},
"shared_info": {

View File

@ -680,7 +680,8 @@
"tabShortcuts": "Scurtături pentru tab-uri",
"troubleshooting": "Unelte pentru depanare",
"newTabWithActivationNoteLink": "pe o legătură către o notiță deschide și activează notița într-un tab nou",
"title": "Ghid rapid"
"title": "Ghid rapid",
"editShortcuts": "Editează scurtăturile de la tastatură"
},
"hide_floating_buttons_button": {
"button_title": "Ascunde butoanele"
@ -1511,7 +1512,8 @@
"hoist-this-note-workspace": "Focalizează spațiul de lucru",
"refresh-saved-search-results": "Reîmprospătează căutarea salvată",
"unhoist": "Defocalizează notița",
"toggle-sidebar": "Comută bara laterală"
"toggle-sidebar": "Comută bara laterală",
"dropping-not-allowed": "Aici nu este permisă plasarea notițelor."
},
"title_bar_buttons": {
"window-on-top": "Menține fereastra mereu vizibilă"
@ -1625,7 +1627,8 @@
"reset": "Resetează"
},
"editable-text": {
"auto-detect-language": "Automat"
"auto-detect-language": "Automat",
"keeps-crashing": "Componenta de editare se blochează în continuu. Încercați să reporniți Trilium. Dacă problema persistă, luați în considerare să raportați această problemă."
},
"highlighting": {
"color-scheme": "Temă de culori",
@ -1677,7 +1680,8 @@
"open_note_in_new_split": "Deschide notița într-un panou nou",
"open_note_in_new_tab": "Deschide notița într-un tab nou",
"open_note_in_new_window": "Deschide notița într-o fereastră nouă",
"open_note_in_popup": "Editare rapidă"
"open_note_in_popup": "Editare rapidă",
"open_note_in_other_split": "Deschide notița în celălalt panou"
},
"note_autocomplete": {
"clear-text-field": "Șterge conținutul casetei",
@ -2101,5 +2105,8 @@
"clear-color": "Înlăturați culoarea notiței",
"set-color": "Setați culoarea notiței",
"set-custom-color": "Setați culoare personalizată pentru notiță"
},
"popup-editor": {
"maximize": "Comută la editorul principal"
}
}

View File

@ -1,5 +1,5 @@
import { allViewTypes, ViewModeMedia, ViewModeProps, ViewTypeOptions } from "./interface";
import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useTriliumEvent } from "../react/hooks";
import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumEvent } from "../react/hooks";
import FNote from "../../entities/fnote";
import "./NoteList.css";
import { useEffect, useRef, useState } from "preact/hooks";
@ -53,10 +53,11 @@ const ViewComponents: Record<ViewTypeOptions, { normal: LazyLoadedComponent, pri
export default function NoteList(props: Pick<NoteListProps, "displayOnlyCollections" | "media" | "onReady" | "onProgressChanged">) {
const { note, noteContext, notePath, ntxId, viewScope } = useNoteContext();
const viewType = useNoteViewType(note);
const noteType = useNoteProperty(note, "type");
const [ enabled, setEnabled ] = useState(noteContext?.hasNoteList());
useEffect(() => {
setEnabled(noteContext?.hasNoteList());
}, [ note, noteContext, viewType, viewScope?.viewMode ])
}, [ note, noteContext, viewType, viewScope?.viewMode, noteType ])
return <CustomNoteList viewType={viewType} note={note} isEnabled={!!enabled} notePath={notePath} ntxId={ntxId} {...props} />
}

View File

@ -24,7 +24,7 @@ describe("Board data", () => {
parentNoteId: "note1"
});
froca.branches["note1_note2"] = branch;
froca.getNoteFromCache("note1").addChild("note2", "note1_note2", false);
froca.getNoteFromCache("note1")!.addChild("note2", "note1_note2", false);
const data = await getBoardData(parentNote, "status", {}, false);
const noteIds = Array.from(data.byColumn.values()).flat().map(item => item.note.noteId);
expect(noteIds.length).toBe(3);

View File

@ -30,7 +30,12 @@ export default function Map({ coordinates, zoom, layerName, viewportChanged, chi
useEffect(() => {
if (!containerRef.current) return;
const mapInstance = L.map(containerRef.current, {
worldCopyJump: true
worldCopyJump: false,
maxBounds: [
[-90, -180],
[90, 180]
],
minZoom: 2
});
mapRef.current = mapInstance;
@ -56,7 +61,8 @@ export default function Map({ coordinates, zoom, layerName, viewportChanged, chi
} else {
setLayer(L.tileLayer(layerData.url, {
attribution: layerData.attribution,
detectRetina: true
detectRetina: true,
noWrap: true
}));
}
}

View File

@ -103,7 +103,7 @@ export default function BranchPrefixDialog() {
<input class="branch-prefix-input form-control" value={prefix} ref={branchInput}
onChange={(e) => setPrefix((e.target as HTMLInputElement).value)} />
{isSingleBranch && branches[0] && (
<div class="branch-prefix-note-title input-group-text"> - {branches[0].getNoteFromCache().title}</div>
<div class="branch-prefix-note-title input-group-text"> - {branches[0].getNoteFromCache()?.title}</div>
)}
</div>
</FormGroup>
@ -113,7 +113,7 @@ export default function BranchPrefixDialog() {
<ul>
{branches.map((branch) => {
const note = branch.getNoteFromCache();
return (
return note && (
<li key={branch.branchId}>
{branch.prefix && <span className="branch-prefix-current">{branch.prefix} - </span>}
{note.title}

View File

@ -91,7 +91,7 @@ function RecentChangesTimeline({ groupedByDate, setShown }: { groupedByDate: Map
return (
<li className={isDeleted ? "deleted-note" : ""}>
<span title={change.date}>{formattedTime}</span>
{ !isDeleted
{ notePath && !isDeleted
? <NoteLink notePath={notePath} title={change.current_title} />
: <DeletedNoteLink change={change} setShown={setShown} /> }
</li>

View File

@ -580,6 +580,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
.loadSearchNote(noteId)
.then(() => {
const note = froca.getNoteFromCache(noteId);
if (!note) return [];
let childNoteIds = note.getChildNoteIds();
@ -591,6 +592,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
})
.then(() => {
const note = froca.getNoteFromCache(noteId);
if (!note) return [];
return this.prepareChildren(note);
});
@ -746,7 +748,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
const node = $.ui.fancytree.getNode(e as unknown as Event);
const note = froca.getNoteFromCache(node.data.noteId);
if (note.isLaunchBarConfig()) {
if (note?.isLaunchBarConfig()) {
import("../menus/launcher_context_menu.js").then(({ default: LauncherContextMenu }) => {
const launcherContextMenu = new LauncherContextMenu(this, node);
launcherContextMenu.show(e);
@ -781,7 +783,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
if (hideArchivedNotes) {
const note = branch.getNoteFromCache();
if (note.hasLabel("archived")) {
if (!note || note.hasLabel("archived")) {
continue;
}
}
@ -1760,7 +1762,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
for (const nodeToDuplicate of nodesToDuplicate) {
const note = froca.getNoteFromCache(nodeToDuplicate.data.noteId);
if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) {
if (note?.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) {
continue;
}

View File

@ -4,7 +4,7 @@ import { isElectron as getIsElectron, isMac as getIsMac } from "../../services/u
import { ParentComponent } from "../react/react_utils";
import { t } from "../../services/i18n"
import { useContext } from "preact/hooks";
import { useIsNoteReadOnly } from "../react/hooks";
import { useIsNoteReadOnly, useNoteLabel, useNoteProperty } from "../react/hooks";
import { useTriliumOption } from "../react/hooks";
import ActionButton from "../react/ActionButton"
import appContext, { CommandNames } from "../../components/app_context";
@ -46,14 +46,16 @@ function RevisionsButton({ note }: { note: FNote }) {
function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: NoteContext }) {
const parentComponent = useContext(ParentComponent);
const noteType = useNoteProperty(note, "type") ?? "";
const [ viewType ] = useNoteLabel(note, "viewType");
const canBeConvertedToAttachment = note?.isEligibleForConversionToAttachment();
const isSearchable = ["text", "code", "book", "mindMap", "doc"].includes(note.type);
const isSearchable = ["text", "code", "book", "mindMap", "doc"].includes(noteType);
const isInOptionsOrHelp = note?.noteId.startsWith("_options") || note?.noteId.startsWith("_help");
const isPrintable = ["text", "code"].includes(note.type) || (note.type === "book" && ["presentation", "list", "table"].includes(note.getLabelValue("viewType") ?? ""));
const isPrintable = ["text", "code"].includes(noteType) || (noteType === "book" && ["presentation", "list", "table"].includes(viewType ?? ""));
const isElectron = getIsElectron();
const isMac = getIsMac();
const hasSource = ["text", "code", "relationMap", "mermaid", "canvas", "mindMap", "aiChat"].includes(note.type);
const isSearchOrBook = ["search", "book"].includes(note.type);
const hasSource = ["text", "code", "relationMap", "mermaid", "canvas", "mindMap", "aiChat"].includes(noteType);
const isSearchOrBook = ["search", "book"].includes(noteType);
const [ syncServerHost ] = useTriliumOption("syncServerHost");
const {isReadOnly, enableEditing} = useIsNoteReadOnly(note, noteContext);

View File

@ -24,9 +24,18 @@
flex-direction: column;
}
.attachment-title {
font-size: 1.1rem;
margin: 0;
a {
color: inherit !important;
}
}
.attachment-title-line {
display: flex;
align-items: baseline;
align-items: center;
gap: 1em;
}
@ -50,6 +59,7 @@
.attachment-detail-wrapper.list-view .attachment-content-wrapper {
max-height: 300px;
overflow: auto;
}
.attachment-detail-wrapper.full-detail {
@ -60,8 +70,16 @@
height: 100%;
}
.attachment-detail-wrapper.list-view {
border-radius: 12px;
background-color: var(--card-background-color);
padding: 0 6px;
box-shadow: var(--card-box-shadow);
}
.attachment-detail-wrapper.list-view .attachment-content-wrapper pre {
max-height: 400px;
padding: 0;
}
.attachment-content-wrapper img {

View File

@ -14,6 +14,7 @@
.note-detail-code-editor {
min-height: 50px;
height: 100%;
padding: 0 !important;
}
/* #endregion */

View File

@ -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", () => {

View File

@ -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 {