1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-26 18:58:21 +02:00

Desktop: Regression: Fix sort tags alphabetically in side-menu (#3489)

This commit is contained in:
Vaidotas Šimkus 2020-07-15 18:28:40 +01:00 committed by GitHub
parent 282f6de1a9
commit 10ff43f4f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
const BaseItem = require('lib/models/BaseItem');
const BaseModel = require('lib/BaseModel');
const Tag = require('lib/models/Tag');
const shared = {};
@ -65,6 +66,13 @@ shared.renderFolders = function(props, renderItem) {
};
shared.renderTags = function(props, renderItem) {
props = Object.assign({}, props);
const tags = props.tags.slice();
// Sort tags alphabetically
tags.sort((a, b) => {
return Tag.getCachedFullTitle(a.id) < Tag.getCachedFullTitle(b.id) ? -1 : 1;
});
props.tags = tags;
return renderItemsRecursive_(props, renderItem, [], '', 0, [], BaseModel.TYPE_TAG);
};