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 3, 2023
1 parent 17c4b96 commit fa3bd32
Show file tree
Hide file tree
Showing 2 changed files with 8 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 @@ -75,8 +75,9 @@ export interface Highlight {
updatedAt: string;
labels?: Label[];
type: HighlightType;
highlightPositionPercent?: number;
highlightPositionPercent: number;
color?: string;
highlightPositionAnchorIndex: number;
}

const requestHeaders = (apiKey: string) => ({
Expand Down Expand Up @@ -132,6 +133,7 @@ export const loadArticles = async (
updatedAt
type
highlightPositionPercent
highlightPositionAnchorIndex
labels {
name
}
Expand Down
5 changes: 5 additions & 0 deletions src/settings/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export interface HighlightView {
dateHighlighted: string;
note?: string;
labels?: LabelView[];
color: string;
positionPercent: number;
positionAnchorIndex: number;
}

export type ArticleView =
Expand Down Expand Up @@ -190,6 +193,8 @@ export const renderArticleContnet = async (
note: highlight.annotation ?? undefined,
labels: renderLabels(highlight.labels),
color: highlight.color ?? 'yellow',
positionPercent: highlight.highlightPositionPercent,
positionAnchorIndex: highlight.highlightPositionAnchorIndex,
};
});
const dateSaved = formatDate(article.savedAt, dateSavedFormat);
Expand Down

0 comments on commit fa3bd32

Please sign in to comment.