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

Get CFI from a specific word

Open nux17 opened this issue 5 years ago • 1 comments

I would like to generate a CFI from a selected word on the epub. I know we can go to a certain place in the epub from a CFI but how get a CFI from "a place" eg. a word?

Thank you.

nux17 avatar May 06 '19 21:05 nux17

Maybe you can get a CFI, than try to use the doChapterSearch Method

function doChapterSearch(q) {
    let item = this.book.spine.get(this.rendition.location.start);
    return item.load(book.load.bind(book)).then(item.find.bind(item, q)).finally(item.unload.bind(item));
};

ZhaoDanyang avatar May 30 '19 06:05 ZhaoDanyang