I am very interested in replicating some Annotation features from Foliate into the foliate-js demo, so I can read books on my Android device.
The first step is obviously to be able to retrieve the selection from the document and get the CFI range. I have added the following to the Reader.onLoad():
doc.addEventListener('selectionchange', this.#onselect.bind(this))
//Where onselect is:
#onselect(range) {
let selection = window.getSelection()
console.log("Selection", selection)
console.log("Range", range)
}
But neither the selection nor range seem to give me specific enough targets to work with.
Hope you can help me.
Hey there. Thanks for developing this library.
I am very interested in replicating some Annotation features from Foliate into the foliate-js demo, so I can read books on my Android device.
The first step is obviously to be able to retrieve the selection from the document and get the CFI range. I have added the following to the
Reader.onLoad()
:But neither the
selection
norrange
seem to give me specific enough targets to work with. Hope you can help me.