1. 15 Mar, 2022 5 commits
    • Robert Knight's avatar
      Add `contentPartner` configuration option · 010c44fd
      Robert Knight authored
      Add an option that enables the embedder to configure a content
      provider/partner banner to be shown in the client, indicating who is
      providing the content.
      010c44fd
    • Robert Knight's avatar
      d0039747
    • Lyza Danger Gardner's avatar
      c052cd18
    • Robert Knight's avatar
      Add option to show content partner banner in PDF integration · 75694446
      Robert Knight authored
      Add an option to show a banner at the top of the PDF viewer indicating
      where the content came from. This is a contractual requirement for
      working with certain content providers.
      75694446
    • Robert Knight's avatar
      Catch mouseup/mousedown events earlier in SelectionObserver · e70287cf
      Robert Knight authored
      Listen for mouseup/mousedown events on the document body rather than document
      itself, so that we can still capture them if an event listener on
      `document.body` or `document.documentElement` stops propagation of the event.
      The VitalSource integration does this for example to prevent VitalSource's own
      selection UI appearing, but ordinary web pages could do something similar.
      
      In VitalSource books, this change makes the adder behave the same as it does in
      HTML and PDF documents where, when making a selection with the mouse, the adder
      only appears when the mouse is released so it doesn't get in the way during the
      selection.
      
      While updating the tests for this change, they were converted to use a real
      document, as the complexity of mocking the relevant parts of the DOM document
      interface accurately is now too high.
      e70287cf
  2. 14 Mar, 2022 10 commits
  3. 11 Mar, 2022 3 commits
  4. 10 Mar, 2022 3 commits
    • Robert Knight's avatar
      Ignore fixed-positioned content which choosing a scroll anchor · 04e8025f
      Robert Knight authored
      When choosing a scroll anchor to preserve the visible content after toggling
      side-by-side mode, ignore content in elements with `position: fixed` or
      `position: sticky` styles, since this content won't significantly shift its
      position as a result of the document content being resized.
      04e8025f
    • Robert Knight's avatar
      Increase timeout in test · 73acd7d2
      Robert Knight authored
      `waitFor` has a short default timeout of 10ms and this test sometimes
      failed in CI. Try increasing it to reduce flakiness. We might want to
      consider changing the `waitFor` default in future, although we also want
      to encourage test authors to avoid writing tests that frequently wait
      for long (> 10ms) periods of time.
      73acd7d2
    • Lyza Danger Gardner's avatar
      61be5879
  5. 09 Mar, 2022 4 commits
    • Robert Knight's avatar
    • Robert Knight's avatar
      01431523
    • Robert Knight's avatar
      Make src/annotator/ and src/boot/ typecheck with `noImplicitAny` · 08fd737c
      Robert Knight authored
       - Add missing types in src/annotator and src/boot.
      
       - Simplify the return types of some config parsing functions by
         coercing invalid values to `null` or some other default. This reduces
         complexity with the types elsewhere and also potentially avoids some
         confusing errors if invalid values are specified here.
      
       - Add type definitions for hammerjs, scroll-into-view and
         lodash.debounce. The definitions for hammerjs and scroll-into-view
         come from DefinitelyTyped. For lodash a minimal custom definition has
         been written because the @types/lodash.debounce package includes
         types for the whole of lodash.
      
         In order to use these types the `allowSyntheticDefaultImports` flag
         had to be enabled in the TS configs.
      
         A consequence of adding types for scroll-into-view is that some
         missing null checks in sidebar components were found.
      08fd737c
    • Lyza Danger Gardner's avatar
      Re-implement `.styled-text` · f090632a
      Lyza Danger Gardner authored
      Re-implement `.styled-text` in Tailwind:
      
      * Simplify as much as possible and only impose rules that directly apply
        to a block of styled text
      * Re-generate heading size scale using `type-scale.com` (previous tool
        is no longer extant)
      * Ensure that all rules operate with `em` units (proportional to
        inherited font size)
      
      A subsequent step would be to extract a styled-text reusable component.
      f090632a
  6. 08 Mar, 2022 11 commits
  7. 04 Mar, 2022 3 commits
    • Lyza Danger Gardner's avatar
      Add local example document with margin-auto, max-width content area · ac8d90e2
      Lyza Danger Gardner authored
      This example can help test side-by-side mode on documents with a
      centered content area (e.g. `body` is set to `margin: 0 auto`) and a
      maximum content (`body`) width. This combination is used for some
      VitalSource EPUB books.
      ac8d90e2
    • Lyza Danger Gardner's avatar
      Make annotator component UI scale correctly to host page · 409706c3
      Lyza Danger Gardner authored
      Make certain annotator components — the adder toolbar popup, e.g. —
      scale when the root font size of the underlying host page changes.
      
      Make sure other annotator UI that is associated with the sidebar — the
      toolbar and bucket bar — do NOT scale with text scaling.
      
      All controls should scale with user/page zoom.
      409706c3
    • Robert Knight's avatar
      Inject client into newly loaded VitalSource book chapters sooner · 9481c420
      Robert Knight authored
      When a new content frame was found in VitalSource the client was only injected
      either if the frame is already loaded, or when the frame next emits a `load`
      event. In the latter case this waits until the document and its subresources
      have fully loaded. This can be slow in EPUB chapters that have a lot of images.
      Improve this by replacing the frame `load` event observer with a call to a new
      `onDocumentReady` function which fires as soon as a document becomes interactive
      (according to its `readyState`).
      
       - Rename existing `onDocumentReady` utility to `onNextDocumentReady` to
         make it clear that it only fires once, and change the implementation to
         be a wrapper around a new `onDocumentReady` function.
      
       - Add new `onDocumentReady` utility which monitors a frame for changes in the
         content document and invokes a callback each time a document becomes _ready_
         (`readyState` is `interactive` or `complete`).
      
       - Redo the tests for utilities in `frame-observer.js` so that they use
         real iframes rather than fake ones. Iframes have a complex interface
         and loading sequence, so we really need to use the real thing for
         tests to give us confidence.
      
       - Use `onDocumentReady` in the VitalSource integration to respond more quickly
         to book content loading in a new content frame.
      
       - Modify several tests for `FrameObserver`, `VitalSourceInjector` and
         `HypothesisInjector` to be less sensitive to exact timings of events,
         as these changed between the previous and new methods for detecting
         when a document is ready.
      
      Fixes https://github.com/hypothesis/client/issues/4270
      9481c420
  8. 02 Mar, 2022 1 commit