forked from akai/readest
a5e09e8454
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
11 lines
328 B
TypeScript
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;
|
|
}
|