• Robert Knight's avatar
    Navigate to appropriate book chapter before scrolling to annotation · 22b134da
    Robert Knight authored
    When clicking an annotation in the sidebar that corresponds to a
    different chapter of a VitalSource book than the one that is currently loaded,
    navigate the book to the chapter associated with the annotation.
    
     - Add `goToCfi` and `goToURL` to the set of `<mosaic-book>` APIs that
       the client uses, and implementations of these in the VitalSource EPUB demo.
    
     - Add optional `navigateToSegment` method for integrations, which
       triggers a navigation to the segment (eg. EPUB chapter) of a document
       that matches an annotation's selectors.
    
     - Add new `navigateToSegment` sidebar => guest RPC call, which forwards
       to the integration's `navigateToSegment` implementation.
    
     - Change `FrameSyncService.scrollToAnnotation` to accept an annotation
       rather than just a tag, so the service can conveniently match the
       annotation against the EPUB chapter information for the guest
    
     - Add logic in `FrameSyncService.scrollToAnnotation` to invoke the
       `navigateToSegment` RPC method instead of `scrollToAnnotation` if the
       annotation is in a different segment of the document than is
       currently loaded.
    
       Once the navigation to the new segment has completed, the document
       still needs to be scrolled to the annotation. FrameSyncService
       service handles this by recording the ID of the annotation in a
       `_pendingScrollToId` field, and then performing the scroll once the
       annotation anchors.
    22b134da
SidebarView.js 5.59 KB