#402: Custom sorting of content now supports number fields

This commit is contained in:
Elio Struyf
2022-09-09 16:44:37 +02:00
parent fe41d9a751
commit 9b21e15c63
3 changed files with 5 additions and 1 deletions
+1
View File
@@ -20,6 +20,7 @@
- [#388](https://github.com/estruyf/vscode-front-matter/issues/388): New stop server action has been added to the panel
- [#390](https://github.com/estruyf/vscode-front-matter/issues/390): Implement another JSON parser in order to be able to parse the `frontmatter.json` file better
- [#394](https://github.com/estruyf/vscode-front-matter/issues/394): Ordering of snippet fields is based on their field definition
- [#402](https://github.com/estruyf/vscode-front-matter/issues/402): Custom sorting of content now supports `number` fields
### ⚡️ Optimizations
+2 -1
View File
@@ -329,7 +329,8 @@
"default": "string",
"enum": [
"string",
"date"
"date",
"number"
],
"description": "Type of the field value"
}
+2
View File
@@ -67,6 +67,8 @@ export default function usePages(pages: Page[]) {
pagesSorted = pagesSorted.sort(Sorting.alphabetically(name));
} else if (type === SortType.date) {
pagesSorted = pagesSorted.sort(Sorting.date(name));
} else if (type === SortType.number) {
pagesSorted = pagesSorted.sort(Sorting.number(name));
}
if (order === SortOrder.desc) {