File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,15 @@ import { DateTime } from 'luxon'
9
9
import { render } from 'mustache'
10
10
import {
11
11
Article ,
12
- compareHighlightsInFile ,
13
12
DATE_FORMAT ,
13
+ HighlightType ,
14
+ PageType ,
15
+ compareHighlightsInFile ,
14
16
escapeQuotationMarks ,
15
17
formatDate ,
16
18
getHighlightLocation ,
17
- HighlightType ,
18
19
loadArticles ,
19
20
loadDeletedArticleSlugs ,
20
- PageType ,
21
21
parseDateTime ,
22
22
} from './util'
23
23
@@ -222,6 +222,13 @@ const fetchOmnivore = async (inBackground = false) => {
222
222
if ( highlightOrder === HighlightOrder . LOCATION ) {
223
223
highlights ?. sort ( ( a , b ) => {
224
224
try {
225
+ // sort by highlight position percent if available
226
+ if (
227
+ a . highlightPositionPercent !== undefined &&
228
+ b . highlightPositionPercent !== undefined
229
+ ) {
230
+ return a . highlightPositionPercent - b . highlightPositionPercent
231
+ }
225
232
if ( article . pageType === PageType . File ) {
226
233
// sort by location in file
227
234
return compareHighlightsInFile ( a , b )
Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ export interface Highlight {
86
86
updatedAt : string
87
87
labels ?: Label [ ]
88
88
type : HighlightType
89
+ highlightPositionPercent ?: number
89
90
}
90
91
91
92
export interface HighlightPoint {
@@ -152,6 +153,7 @@ export const loadArticles = async (
152
153
annotation
153
154
patch
154
155
updatedAt
156
+ highlightPositionPercent
155
157
labels {
156
158
name
157
159
}
You can’t perform that action at this time.
0 commit comments