1. 19 Nov, 2019 3 commits
    • Robert Knight's avatar
      Convert `Excerpt` component to Preact · d1485d0b
      Robert Knight authored
      Convert the `Excerpt` component to Preact. Rather than convert the
      existing implementation verbatim, this is a completely new implementation which
      should be easier to understand and use. Instead of requiring callers to
      provide an input property which represents the displayed data, which triggers a
      re-measurement if it changes, the new implementation observes the DOM
      directly for size changes.
      
      This component renders caller-provided content (ie. it accepts a `children`
      prop), which is not supported by the Preact <-> Angular bridge. Therefore it was
      also necessary to create components (`AnnotationBody`, `AnnotationQuote`) that
      encapsulate uses of `Excerpt` inside the `<annotation>` component.
      
       - Add `observe-element-size` utility module to watch for changes in
         the size of a DOM node using APIs available in the current browser
      
       - Add new `Excerpt` implementation and remove the old one
      
       - Remove `excerpt-overflow-monitor` utility that is not used by the new
         implementation
      
       - Add `AnnotationBody` component to render an annotation's markup body
         inside a (new) excerpt and convert the Angular template for
         `<annotation>` (annotation.html) to use it.
      
       - Add `AnnotationQuote` component to render an annotation's quote
         inside an excerpt and convert `annotation.html` to use it
      d1485d0b
    • Robert Knight's avatar
      Merge pull request #1477 from hypothesis/observe-element-size · d9abd85d
      Robert Knight authored
      Convert excerpt to Preact (1/n) - Add a utility to observe element size changes
      d9abd85d
    • Robert Knight's avatar
      Merge pull request #1479 from hypothesis/annotator-toolbar-focus-ring · 73e0e81a
      Robert Knight authored
      Show focus ring on annotator toolbar buttons when using keyboard focus
      73e0e81a
  2. 18 Nov, 2019 19 commits
  3. 15 Nov, 2019 5 commits
  4. 14 Nov, 2019 1 commit
    • Lyza Danger Gardner's avatar
      Prevent errors arising from applying private permissions to anonymous annotations · 8ca4773b
      Lyza Danger Gardner authored
      As a convenience, the app retains the last permissions level used by a user when publishing an annotation. For example, if a user creates and saves and annotation that is set to “only me”/private, the app stashes that as a pseudo-preference in `localStorage` and the next time a user creates a new annotation, that will be the default permissions level applied to it. This makes it easier to create several subsequent annotations that have the same permissions/sharing setting.
      
      There is a bug in this approach, however, which before this patch happened when:
      
      * A Hypothesis user creates an annotation and sets the permissions to “private” (only me) and saves the annotation successfully to the `h` service, then;
      * The Hypothesis user logs out, then;
      * The same person in the same browser (now an anonymous user from Hypothesis’ perspective) selects some text and clicks “annotate., then;
      * The user is shown an error message that they must log in to create annotations: they click “Log In”
      
      Before this fix, the user then would see an error “Cannot read property ‘split’ of null” in an error flash and the login process would not successfully complete. The only workaround was to reload the browser window and try again.
      
      After this fix, the user will not see an error after the sequence detailed above and the login process will complete.
      
      This fix is achieved by preventing the app from attempting to apply default permissions of “only me”/private when no `userid` is available. Doing so creates corrupted permissions on the annotation which throw `TypeError`s when later iterated over.
      
      There are several further fixes necessary to fully clean up this situation, but this patches over the immediate user-visible bug.
      
      Fixes https://github.com/hypothesis/client/issues/1221
      8ca4773b
  5. 13 Nov, 2019 3 commits
  6. 12 Nov, 2019 7 commits
  7. 11 Nov, 2019 2 commits