Skip to content

Commit

Permalink
Fix EPUB find annotation shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeJellinek committed Nov 13, 2024
1 parent cb88128 commit 1c7fa23
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dom/epub/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,17 @@ export class EPUBFindProcessor implements FindProcessor {
let index = 0;
let foundSelected = false;
let snippets = [];
let range: PersistentRange | undefined;
for (let processor of this._processors) {
if (!processor) {
continue;
}
if (this._selectedProcessor == processor) {
index += processor.position ?? 0;
let position = processor.position ?? 0;
index += position;
foundSelected = true;
// TODO: Expose this in a nicer way
range = processor.getAnnotations()[position]?.range;
}
else if (!foundSelected) {
index += processor.getResults().length;
Expand All @@ -182,6 +186,7 @@ export class EPUBFindProcessor implements FindProcessor {
total: this._totalResults,
index,
snippets,
range,
});
}
}
Expand Down

0 comments on commit 1c7fa23

Please sign in to comment.