ionic-epubjs icon indicating copy to clipboard operation
ionic-epubjs copied to clipboard

Implement Search (in chapter)

Open janpio opened this issue 7 years ago • 0 comments

Searching in the current chapter could be useful:

book.currentChapter.find("Some Text to look for");

/*
 *  This returns an array of objects like: 
 * [{
 *     "cfi": "epubcfi(/6/18[chap-1]!4/2/30/1:24,1:31)",
 *     "excerpt": "...here is some text to look for..."
 * }, {
 *     "cfi": "epubcfi(/6/18[chap-1]!4/2/66/1:22,1:29)",
 *     "excerpt": "...I have found some more text to look for in this book..."
 * }]
 * 
 * The array can be looped over with a for loop, and used for search results. 
 * This function is case insensitive.
 * Note that this only searches the current chapter.
 * 
 */

https://github.com/futurepress/epub.js/wiki/Tips-and-Tricks#searching-the-current-chapter

janpio avatar Jul 19 '17 18:07 janpio