Skip to content

Build your personal knowledge base with Trilium Notes

feat(views/table): format note ID as monospace

Elian Dorancf8063f31166
diff --git a/apps/client/src/widgets/view_widgets/table_view/columns.ts b/apps/client/src/widgets/view_widgets/table_view/columns.ts
index 560efdf4bc..7a8348e4e7 100644
--- a/apps/client/src/widgets/view_widgets/table_view/columns.ts
+++ b/apps/client/src/widgets/view_widgets/table_view/columns.ts
@@ -1,6 +1,6 @@
import { RelationEditor } from "./relation_editor.js";
-import { NoteFormatter, NoteTitleFormatter, RowNumberFormatter } from "./formatters.js";
-import type { ColumnDefinition, Tabulator } from "tabulator-tables";
+import { MonospaceFormatter, NoteFormatter, NoteTitleFormatter, RowNumberFormatter } from "./formatters.js";
+import type { ColumnDefinition } from "tabulator-tables";
import { LabelType } from "../../../services/promoted_attribute_definition_parser.js";
type ColumnType = LabelType | "relation";
@@ -55,6 +55,7 @@ export function buildColumnDefinitions(info: AttributeDefinitionInformation[], m
{
field: "noteId",
title: "Note ID",
+ formatter: MonospaceFormatter,
visible: false
},
{
diff --git a/apps/client/src/widgets/view_widgets/table_view/formatters.ts b/apps/client/src/widgets/view_widgets/table_view/formatters.ts
index 15701bc5cc..07c9d10607 100644
--- a/apps/client/src/widgets/view_widgets/table_view/formatters.ts
+++ b/apps/client/src/widgets/view_widgets/table_view/formatters.ts
@@ -47,6 +47,10 @@ export function RowNumberFormatter(draggableRows: boolean) {
};
}
+export function MonospaceFormatter(cell: CellComponent) {
+ return `<code>${cell.getValue()}</code>`;
+}
+
function buildNoteLink(noteId: string) {
const $noteRef = $("<span>");
const href = `#root/${noteId}`;