react-native-readium
react-native-readium copied to clipboard
[Feature Request] Ability to highlight
Can highlighting be added?
@kyagie theoretically any feature that's supported by readium can be implemented in this library. Are you able to submit a PR? I can provide guidance.
@jspizziri I'd appreciate if you could share your guidance for this as I might be able to find time to work on it
@TechWilk thanks for expressing interest!
The first thing I'd recommend is taking a look at the swift-toolkit and the kotlin-toolkit which this project wraps. Specifically, you can look at the Test Apps that are included in those projects and how they implement highlighting.
Next I suppose we'd need to decide on what the interface for this library is based on that. There's probably some basic highlight data structure/interface that we'd need to pass into readium from RN. My guess is it will take something of the following form:
<ReadiumView
highlights={[some array of highlight datastructures]}
onHighlight={(highlight) => {}}
/>
LMK if that makes sense or if I can provide more guidance.
In the Readium toolkit, we use the term Decoration instead of "highlight" because they can be used for other use cases (TTS, search...) or even other types of decorations (e.g. page marks). Highlights are only mentioned in the Test App, where they basically associate a Decoration style to a Locator in the database.
You can find a high-level spec for the Readium Decorator API here: https://readium.org/architecture/proposals/008-decorator-api.html
And here's a concrete explanation of how to use the Swift API (we don't have user guides for the Decorator API yet): https://github.com/readium/swift-toolkit/discussions/17#discussioncomment-1658858
Here's an example that uses Decorations that don't look like highlights: https://github.com/readium/kotlin-toolkit/pull/310