react-native-readium icon indicating copy to clipboard operation
react-native-readium copied to clipboard

[Feature Request] Ability to highlight

Open kyagie opened this issue 3 years ago • 5 comments
trafficstars

Can highlighting be added?

kyagie avatar Sep 28 '22 17:09 kyagie

@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 avatar Sep 28 '22 17:09 jspizziri

@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 avatar Mar 28 '23 14:03 TechWilk

@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.

jspizziri avatar Mar 28 '23 16:03 jspizziri

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

mickael-menu avatar Mar 28 '23 19:03 mickael-menu

Here's an example that uses Decorations that don't look like highlights: https://github.com/readium/kotlin-toolkit/pull/310

mickael-menu avatar Mar 28 '23 19:03 mickael-menu