Compare commits
2 Commits
27bc12146c
...
e32c2391a0
| Author | SHA1 | Date | |
|---|---|---|---|
| e32c2391a0 | |||
| bbbf82ff93 |
|
|
@ -56,12 +56,16 @@ function sort(id, property, direction) {
|
|||
let children = this.getChildren(id)
|
||||
if (property === 'todo') {
|
||||
children = _.orderBy(children, item => {
|
||||
let res = item.text.match(/^#\[\[(TODO|DONE)/)
|
||||
const res = item.text.match(/^#\[\[(TODO|DONE)/)
|
||||
if (!res) return "C";
|
||||
if (res[1] === 'TODO') return direction === 'asc' ? "A" : "B";
|
||||
if (res[1] === 'DONE') return direction === 'asc' ? "B" : "A";
|
||||
if (res[1] === 'TODO') return "A";
|
||||
if (res[1] === 'DONE') return "B";
|
||||
return "D";
|
||||
}, direction)
|
||||
} else if (property === 'text') {
|
||||
children = _.orderBy(children, item => {
|
||||
return item.text.replace(/^#\[\[(TODO|DONE)]]\s*/, '')
|
||||
}, direction)
|
||||
} else {
|
||||
children = _.orderBy(children, property, direction)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user