1. 15 Apr, 2020 2 commits
    • Robert Knight's avatar
      Use `watch` utility in `frame-sync` · 6dc9ad86
      Robert Knight authored
      6dc9ad86
    • Robert Knight's avatar
      Add utility to watch for changes in certain values · c313ec3b
      Robert Knight authored
      This will be used to streamline a common pattern in our code for
      reacting to changes in state selected from the central Redux store.
      
      The utility is a standalone function rather than a method of the store
      so that it can easily be used with mock stores and also other data
      sources in future.
      
      ```
      watch(
        store.subscribe,
        () => store.getState().someValue,
        (currentValue, prevValue) => { /* Handle change */ },
      );
      ```
      c313ec3b
  2. 14 Apr, 2020 4 commits
  3. 13 Apr, 2020 20 commits
  4. 11 Apr, 2020 1 commit
    • Robert Knight's avatar
      Improve readability of PDF highlights · 55e4ad5a
      Robert Knight authored
      Improve the readability of highlights on PDFs by creating the highlights
      in an SVG layer overlaid on top of the page's `<canvas>` instead of
      using the CSS `background-color` property on the
      `<hypothesis-highlight>` elements in the page's text layer.
      
      Using an SVG placed in the DOM like this allows us to control how
      the highlight is blended with the content underneath using CSS
      `mix-blend-mode`. Using the `multiply` blend mode [2] means that highlights
      will darken the content below rather than making dark text in the
      canvas appear lighter and muddier. Additionally this approach gives us
      more control over the appearance of overlapping highlights. Note that
      for the custom blending to work, it is important that the SVG is in the
      same stacking context as the canvas [1]
      
      We still need to keep the `<hypothesis-highlight>` elements in the text layer
      for interactive functionality (eg. interacting with highlights using the
      keyboard or pointer). The SVG highlight is associated with the
      `<hypothesis-highlight>` via an `svgHighlight` property so that the SVG
      can be removed when the highlight itself is removed.
      
      [1] https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS
      [2] https://drafts.fxtf.org/compositing-1/#valdef-blend-mode-multiply
      55e4ad5a
  5. 10 Apr, 2020 4 commits
  6. 09 Apr, 2020 1 commit
  7. 08 Apr, 2020 6 commits
    • Robert Knight's avatar
      Update Preact · 46063eb9
      Robert Knight authored
      This fixes an issue where an uncaught error thrown inside an `act` callback would
      stop any `useEffect` effects from running for the rest of the test
      session, which was pretty confusing to debug.
      
      See https://github.com/preactjs/preact/releases/tag/10.4.0
      46063eb9
    • Robert Knight's avatar
      Merge pull request #2011 from hypothesis/replace-angular-run · 2e287c68
      Robert Knight authored
      Use `Injector` to initialize services
      2e287c68
    • Robert Knight's avatar
      Merge pull request #2012 from hypothesis/remove-direct-session-state-access · 6e0e57d3
      Robert Knight authored
      Refactor profile data access in the store
      6e0e57d3
    • Robert Knight's avatar
      Refactor profile data access in the store · 2ec09cad
      Robert Knight authored
      This PR refactors accessing and updating of profile data from
      `/api/profile` in the store:
      
       - Always access the profile data fetched from `/api/profile` via the
         `store.profile()` selector rather than using
         `store.getState().session...`.
      
       - Move the profile data from the top level of `state.session` into a
         `profile` field (`state.session.profile`)
      
       - Rename `store.updateSession()` to `store.updateProfile()` for
         consistency with the `profile()` selector. The previous name is a
         holdover from when "session" meant "the user's cookie session".
      
      These changes make this store module follow our agreed best practices to
      avoid accessing state directly, rather than via a selector, and will also
      make it easier to add additional session-related state in future which
      is not fetched from `/api/profile`.
      
      One subtle but intended change is that `state.session.profile` is now
      always _replaced_ when the profile is udpated, rather than it being the
      result of merging the previous and current state. The previous behavior
      could introduce subtle bugs where state from a previous login remained
      after switching the user.
      2ec09cad
    • Robert Knight's avatar
      Use `Injector` to run initialization functions · 4d210869
      Robert Knight authored
      Replace Angular's `run` function which is used to run initialization
      logic once all services are constructed with a new `Injector#run`
      method.
      
      This allows us to remove the dependency on Angular for running app
      initialization logic which requires access to service instances. As a
      result, services that are not used by remaining Angular components no
      longer need to be registered with Angular at all.
      4d210869
    • Robert Knight's avatar
      Merge pull request #1996 from hypothesis/improve-nested-highlight-readability · b53d31d7
      Robert Knight authored
      Improve readability of nested highlights in PDFs
      b53d31d7
  8. 07 Apr, 2020 1 commit
    • Kyle Keating's avatar
      Fix press `Tab` to add a tag · d8157154
      Kyle Keating authored
      - Tab will add the first suggestion in the autocomplete list if the list is not empty and `Tab` is pressed without any suggestion being selected.
      - Tab can act as `Enter` or `,` and add a selected tag from a list when pressed.
      d8157154
  9. 06 Apr, 2020 1 commit
    • Kyle Keating's avatar
      Call requestGroups to get groups filter · b76a94a8
      Kyle Keating authored
      Allow `groups` filter to resolve from an RCP ancestor frame
      - If the groups array exists at load time, leave it in place.
      - If the groups array value is equal to '$rcp:requestGroups' then fetch that value with a second RCP request to the ancestor frame.
      b76a94a8