Skip to content

Commit

Permalink
feat: expose positionPercent and positionAnchorIndex variables in hig…
Browse files Browse the repository at this point in the history
…hlight template (#150)
  • Loading branch information
sywhb committed Nov 6, 2023
1 parent 4d8181e commit 9d4f20d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ export interface Highlight {
updatedAt: string
labels?: Label[]
type: HighlightType
highlightPositionPercent?: number
highlightPositionPercent: number
color?: string
highlightPositionAnchorIndex: number
}

const ENDPOINT = 'https://api-prod.omnivore.app/api/graphql'
Expand Down Expand Up @@ -133,6 +134,7 @@ export const getOmnivoreArticles = async (
patch
updatedAt
highlightPositionPercent
highlightPositionAnchorIndex
labels {
name
}
Expand Down
4 changes: 4 additions & 0 deletions src/settings/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export type HighlightView =
rawDateHighlighted: string
note?: string
color: string
positionPercent: number
positionAnchorIndex: number
}
| FunctionMap

Expand Down Expand Up @@ -192,6 +194,8 @@ export const renderHighlightContent = (
rawDateHighlighted,
note: highlight.annotation ?? undefined,
color: highlight.color ?? 'yellow',
positionPercent: highlight.highlightPositionPercent,
positionAnchorIndex: highlight.highlightPositionAnchorIndex,
...functionMap,
}
return Mustache.render(template, highlightView)
Expand Down

0 comments on commit 9d4f20d

Please sign in to comment.