mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
resort attributes for display
This commit is contained in:
parent
981fac8e50
commit
5ed1631a35
@ -640,13 +640,18 @@ class NoteShort {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getAttributes()
|
const promotedAttrs = this.getAttributes()
|
||||||
.filter(attr => attr.isDefinition())
|
.filter(attr => attr.isDefinition())
|
||||||
.filter(attr => {
|
.filter(attr => {
|
||||||
const def = attr.getDefinition();
|
const def = attr.getDefinition();
|
||||||
|
|
||||||
return def && def.isPromoted;
|
return def && def.isPromoted;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// attrs are not resorted if position changes after initial load
|
||||||
|
promotedAttrs.sort((a, b) => a.position < b.position ? -1 : 1);
|
||||||
|
|
||||||
|
return promotedAttrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasAncestor(ancestorNoteId, visitedNoteIds = null) {
|
hasAncestor(ancestorNoteId, visitedNoteIds = null) {
|
||||||
|
@ -468,6 +468,8 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {
|
|||||||
|
|
||||||
async renderOwnedAttributes(ownedAttributes, saved) {
|
async renderOwnedAttributes(ownedAttributes, saved) {
|
||||||
ownedAttributes = ownedAttributes.filter(oa => !oa.isDeleted);
|
ownedAttributes = ownedAttributes.filter(oa => !oa.isDeleted);
|
||||||
|
// attrs are not resorted if position changes after initial load
|
||||||
|
ownedAttributes.sort((a, b) => a.position < b.position ? -1 : 1);
|
||||||
|
|
||||||
let htmlAttrs = (await attributeRenderer.renderAttributes(ownedAttributes, true)).html();
|
let htmlAttrs = (await attributeRenderer.renderAttributes(ownedAttributes, true)).html();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user