1. 25 Feb, 2022 9 commits
    • Robert Knight's avatar
      Revise a comment per code review feedback · d07daebb
      Robert Knight authored
      d07daebb
    • Robert Knight's avatar
      Preserve scroll position after toggling side-by-side mode in web pages · a3d50a93
      Robert Knight authored
      Toggling side-by-side mode in a web page reflows the content. If the absolute
      scroll position stays the same, the logical position in the document will change
      and the user would have to scroll to find the content they were
      previously reading.
      
      To avoid this add logic which picks content in the viewport to use as a _scroll
      anchor_, before the document is resized. After the document is resized, the
      scroll position is changed so that the vertical position of the scroll anchor in
      the viewport is the same as before. This keeps most of the content on screen.
      
      The scroll anchor is currently chosen by picking the first _word_
      (non-whitespace substring of a text node) which is visible in the viewport,
      represented as a DOM Range. This fine-grained scroll anchor is chosen rather
      than eg. just a DOM element, because long paragraphs may change in size
      substantially relative to the viewport after resizing the document, so just
      preserving the location of the paragraph element would not preserve the content
      that is on screen.
      
       - Add `preserveScrollPosition` helper in html-side-by-side.js which
         picks a scroll anchor, invokes a callback and then restores the
         position of the scroll anchor.
      
       - Make the HTML integration use `preserveScrollPosition` to preserve
         the scroll position after activating and de-activating side-by-side
         mode
      
       - Add helper functions in src/annotator/util/geometry for comparing
         DOMRect objects
      a3d50a93
    • Robert Knight's avatar
    • Robert Knight's avatar
      Take into account padding when computing free space · 974c4c0b
      Robert Knight authored
      When computing the amount of free space between the right edge of the
      main content and the edge of the sidebar, allow for the padding
      allocated between the sidebar and the content. This fixes an issue where
      the main content would touch the sidebar exactly instead of having a
      margin between it and the content.
      
      Also tweak the padding value slightly to be a multiple of the 4px grid
      cell size used in the design system.
      974c4c0b
    • Robert Knight's avatar
      Add missing calls to `act` in `useStoreProxy` tests · afd62649
      Robert Knight authored
      Add calls to `act` around proxy method calls that trigger store changes
      which in turn schedule deferred updates within Preact components. This
      should hopefully fix an issue with flakey tests due to updates being
      flushed after the tests have finished executing.
      afd62649
    • Robert Knight's avatar
      Make content frame in VitalSource EPUB fill full width of window · 818a6159
      Robert Knight authored
      This makes the VS EPUB test page more accurately reflect the real VitalSource
      viewer. More importantly, it also triggers the heuristic that the Guest class
      uses to decide whether to enable side-by-side mode for an iframed guest.
      818a6159
    • Robert Knight's avatar
      Enable side-by-side mode for iframe guests that fill the host page · eefac00b
      Robert Knight authored
      To make side-by-side mode work for VitalSource EPUB books, the guest in
      the VS content iframe needs to invoke the integration's `fitSideBySide`
      method. This is done in a generic way by making guests in iframes call
      this method, but only if they know that the iframe fills the host frame.
      eefac00b
    • Robert Knight's avatar
      Implement side-by-side mode for VitalSource EPUB books · 1a15838c
      Robert Knight authored
      In the VitalSource integration, enable the side-by-side mode in the
      underlying HTML document integration.
      1a15838c
    • Robert Knight's avatar
      Implement side-by-side mode for HTML documents · d81b73af
      Robert Knight authored
      Implement side-by-side mode for HTML documents, disabled by default by a
      a `HTMLIntegration.sideBySideEnabled` feature flag.
      
      For ease of testing, some helpers have been split into a separate
      html-side-by-side.js module.
      d81b73af
  2. 24 Feb, 2022 2 commits
  3. 22 Feb, 2022 2 commits
    • Robert Knight's avatar
      Add `yarn typecheck-no-any` command · 1c9b7334
      Robert Knight authored
      Add a command which runs TypeScript against a subset of the codebase, currently
      just src/shared/, with the `noImplicitAny` option enabled.
      
      This will allow us to gradually work towards the goal of having the entire
      client codebase typecheck with this option enabled. Once this state is reached
      the `noImplicitAny` option can be enabled in the main TS config file
      (src/tsconfig.json) and the `yarn typecheck-no-any` command and associated TS
      config file can be removed.
      1c9b7334
    • Robert Knight's avatar
      Make src/shared/ typecheck when `noImplicitAny` is set · e9a69d14
      Robert Knight authored
      Fix various errors and omissions found when TypeScript's `noImplicitAny`
      option is enabled.
      e9a69d14
  4. 21 Feb, 2022 13 commits
  5. 16 Feb, 2022 1 commit
  6. 15 Feb, 2022 2 commits
  7. 14 Feb, 2022 11 commits