Find all the cfis of a text / word / words provided by the user in epub #639
Description
I have created a search box where user can type a text he wishes to find. I want to find all the cfis for that text in my epub document. I already tried this -
readium.reader.on("renderer:selected", function(range) {
console.log("inside renderer:selected");
var epubcfi = new EPUBJS.EpubCFI();
var cfi = epubcfi.generateCfiFromRangeAnchor(range,book.renderer.currentChapter.cfiBase);
console.log("selected:", cfi );
});
I thought this would work when user selects any text in the epub. But this does not work.
I searched and found a epub search engine completed by lars vogit.
https://github.com/larsvoigt/epub-full-text-search
It returns all the cfis when a search query is made with the intended word which is what I need right now. But this is not a readium project and commands like import or require does not seem to work in readium
so I had no way to incorporate this in my project.