From e4892c9888d08a42f30bb978b9f48304f0ac8f3e Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 20 Jul 2023 23:22:31 +0200 Subject: [PATCH] fixed order of multi-valued promoted attributes, closes #4105 --- package-lock.json | 1 - src/public/app/widgets/ribbon_widgets/promoted_attributes.js | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 205a2d1f2..6eeedd240 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "trilium", "version": "0.60.4", "hasInstallScript": true, "license": "AGPL-3.0-only", diff --git a/src/public/app/widgets/ribbon_widgets/promoted_attributes.js b/src/public/app/widgets/ribbon_widgets/promoted_attributes.js index 48bf93f5c..a346d76d5 100644 --- a/src/public/app/widgets/ribbon_widgets/promoted_attributes.js +++ b/src/public/app/widgets/ribbon_widgets/promoted_attributes.js @@ -73,6 +73,10 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget { const promotedDefAttrs = note.getPromotedDefinitionAttributes(); const ownedAttributes = note.getOwnedAttributes(); + // attrs are not resorted if position changes after the initial load + // promoted attrs are sorted primarily by order of definitions, but with multi-valued promoted attrs + // the order of attributes is important as well + ownedAttributes.sort((a, b) => a.position < b.position ? -1 : 1); if (promotedDefAttrs.length === 0) { this.toggleInt(false);