mirror of
https://github.com/zadam/trilium.git
synced 2025-01-15 19:51:57 +08:00
added random ordering
This commit is contained in:
parent
c5b0c60797
commit
02988ed2b3
2 changed files with 5 additions and 1 deletions
|
@ -21,6 +21,7 @@ const TPL = `
|
|||
<option value="ownedLabelCount">Number of labels</option>
|
||||
<option value="ownedRelationCount">Number of relations</option>
|
||||
<option value="targetRelationCount">Number of relations targeting the note</option>
|
||||
<option value="random">Random order</option>
|
||||
</select>
|
||||
|
||||
<select name="orderDirection" class="form-control w-auto d-inline">
|
||||
|
|
|
@ -69,7 +69,7 @@ class ValueExtractor {
|
|||
|
||||
i++;
|
||||
}
|
||||
else if (pathEl in PROP_MAPPING) {
|
||||
else if (pathEl in PROP_MAPPING || pathEl === 'random') {
|
||||
if (i !== this.propertyPath.length - 1) {
|
||||
return `${pathEl} is a terminal property specifier and must be at the end`;
|
||||
}
|
||||
|
@ -113,6 +113,9 @@ class ValueExtractor {
|
|||
else if (cur() === 'children') {
|
||||
cursor = cursor.children[0];
|
||||
}
|
||||
else if (cur() === 'random') {
|
||||
return Math.random();
|
||||
}
|
||||
else if (cur() in PROP_MAPPING) {
|
||||
return cursor[PROP_MAPPING[cur()]];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue