Skip to content

Build your personal knowledge base with Trilium Notes

feat(board/promoted_attributes): support multiple values

Elian Doran54d3936c7b00
diff --git a/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx b/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx
index 0ada5f8239..a90d48ce45 100644
--- a/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx
+++ b/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx
@@ -96,12 +96,24 @@ function getAttributesWithDefinitions(note: FNote, attributesToIgnore: string[]
for (const attr of promotedDefinitionAttributes) {
const def = attr.getDefinition();
const [ type, name ] = attr.name.split(":", 2);
- const value = type === "label" ? note.getLabelValue(name) : note.getRelationValue(name);
const friendlyName = def?.promotedAlias || name;
- if (!value) continue;
- if (attributesToIgnore.includes(name)) continue;
+ const props: Omit<AttributeWithDefinitions, "value"> = { def, name, type, friendlyName };
+
+ if (type === "label") {
+ const labels = note.getLabels(name);
+ for (const label of labels) {
+ if (!label.value) continue;
+ result.push({ ...props, value: label.value } );
+ }
+ } else if (type === "relation") {
+ const relations = note.getRelations(name);
+ for (const relation of relations) {
+ if (!relation.value) continue;
+ result.push({ ...props, value: relation.value } );
+ }
+ }
- result.push({ def, name, type, value, friendlyName });
+ if (attributesToIgnore.includes(name)) continue;
}
return result;
}