Files
readest/apps/readest-app/src/utils/cfi.ts
T
Huang Xin a5e09e8454 feat(search): add search results navigation bar, closes #1183 (#2842)
Add a floating navigation component that appears when search results exist.
The component includes:
   - Top bar: displays search term and current section with TOC and close buttons
   - Bottom bar: search results, previous, and next navigation buttons
   - Page-based navigation using isCfiInLocation to skip between pages with results
2026-01-03 08:10:23 +01:00

11 lines
328 B
TypeScript

import * as CFI from 'foliate-js/epubcfi.js';
export function isCfiInLocation(cfi: string, location: string | null | undefined): boolean {
if (!location) return false;
const start = CFI.collapse(location);
const end = CFI.collapse(location, true);
return CFI.compare(cfi, start) >= 0 && CFI.compare(cfi, end) <= 0;
}