mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Sort items in the notebook by position
This commit is contained in:
parent
5891dbae10
commit
12e26397e6
1 changed files with 5 additions and 2 deletions
|
|
@ -74,8 +74,11 @@ struct HighlightListItemParams: Identifiable {
|
|||
private func loadHighlights(item: LinkedItem) {
|
||||
let unsortedHighlights = item.highlights.asArray(of: Highlight.self)
|
||||
|
||||
let highlights = unsortedHighlights.sorted {
|
||||
($0.createdAt ?? Date()) < ($1.createdAt ?? Date())
|
||||
let highlights = unsortedHighlights.sorted { left, right in
|
||||
if left.positionPercent > 0, right.positionPercent > 0 {
|
||||
return left.positionPercent < right.positionPercent
|
||||
}
|
||||
return (left.createdAt ?? Date()) < (right.createdAt ?? Date())
|
||||
}
|
||||
|
||||
highlightItems = highlights.map {
|
||||
|
|
|
|||
Loading…
Reference in a new issue