mirror of
https://github.com/zadam/trilium.git
synced 2025-12-17 13:49:58 +01:00
feat(board/promoted_attributes): support multiple values
This commit is contained in:
@@ -96,12 +96,24 @@ function getAttributesWithDefinitions(note: FNote, attributesToIgnore: string[]
|
|||||||
for (const attr of promotedDefinitionAttributes) {
|
for (const attr of promotedDefinitionAttributes) {
|
||||||
const def = attr.getDefinition();
|
const def = attr.getDefinition();
|
||||||
const [ type, name ] = attr.name.split(":", 2);
|
const [ type, name ] = attr.name.split(":", 2);
|
||||||
const value = type === "label" ? note.getLabelValue(name) : note.getRelationValue(name);
|
|
||||||
const friendlyName = def?.promotedAlias || name;
|
const friendlyName = def?.promotedAlias || name;
|
||||||
if (!value) continue;
|
const props: Omit<AttributeWithDefinitions, "value"> = { def, name, type, friendlyName };
|
||||||
if (attributesToIgnore.includes(name)) continue;
|
|
||||||
|
|
||||||
result.push({ def, name, type, value, 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 } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attributesToIgnore.includes(name)) continue;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user