1. 08 Mar, 2021 2 commits
    • Robert Knight's avatar
      Add tests for adder toolbar callbacks in Guest · 91f96795
      Robert Knight authored
      Add tests for the main code paths in `Guest` that call `createAnnotation`.
      91f96795
    • Robert Knight's avatar
      Refactor Guest#createAnnotation for readability · 5300b58c
      Robert Knight authored
      Convert the `createAnnotation` method of `Guest` to use async/await
      instead of manual chaining of Promise operations. This makes it easier
      to follow the logic and see that document metadata is assigned to the
      annotation before it is broadcast to other parts of the annotator in the
      `beforeAnnotationCreated` event. It also makes it easier to external
      code (eg. the tests) to determine when `createAnnotation` is "done" and
      has finished updating the annotation.
      
       - Convert `Guest#createAnnotation` to use async/await
      
       - Update tests for `createAnnotation` to await the returned Promise
         instead of a fixed timeout
      
       - Add a missing check in `createAnnotation` tests for the argument
         passed to the `beforeAnnotationCreated` event
      5300b58c
  2. 05 Mar, 2021 9 commits
    • Lyza Danger Gardner's avatar
      9cb70c87
    • Lyza Danger Gardner's avatar
      Make links to annotation documents open in new tab/window · 37803f91
      Lyza Danger Gardner authored
      Open links to documents in a new tab. This is important in the Notebook
      view at present to "escape" the Notebook's frame, but makes sense in
      all contexts as it more closely adheres to our pattern of opening links
      to external properties in new windows.
      37803f91
    • Lyza Danger Gardner's avatar
      Adjust styling on document metadata · 76d03be3
      Lyza Danger Gardner authored
      Make sure document titles that are not linked don't look like links.
      76d03be3
    • Lyza Danger Gardner's avatar
      Simplify `AnnotationTimestamps` · bc58c21c
      Lyza Danger Gardner authored
      Make `AnnotationTimestamps` align with changes to `ShowDocumentInfo`;
      it is now a dumb component. Centralize logic in `AnnotationHeader`.
      bc58c21c
    • Lyza Danger Gardner's avatar
      Do not link to documents for third-party annotations · 0aa62e16
      Lyza Danger Gardner authored
      - Refactor `ShowDocumentInfo`: don't link to documents for third-party
        annotations. This is a possibly-temporary measure to prevent linking
        to documents that are not directly accessible, e.g. in an LMS context.
      - Remove unnecessary forwarding of `showDocumentInfo` through several
        components.
      - Centralize some logic in `AnnotationHeader` and make `ShowDocumentInfo`
        a dumb component.
      0aa62e16
    • Eduardo Sanz García's avatar
      Avoid leaving elements from bucket-bar test · 72208f96
      Eduardo Sanz García authored
      These changes enforce that the bucket-bar is destroyed and allows
      multiple creations of the bucket bar, if needed.
      72208f96
    • Robert Knight's avatar
      Generalize a comment · cebe7dbd
      Robert Knight authored
      The sidebar is not the only other frame that may be interested in new
      annotations. The notebook is too.
      cebe7dbd
    • Robert Knight's avatar
      Improve tests for `getDocumentInfo` event handling in Guest · 6bcf0b8c
      Robert Knight authored
       - Extract the repeated logic for checking the data passed to the
         event's callback into a `createCallback` helper
      
       - Add separate tests for HTML and PDF documents
      
       - Add test for the error path when getting the URL of a PDF fails
      6bcf0b8c
    • Robert Knight's avatar
      Replace the "plugin" functionality in the Guest · bcd65da1
      Robert Knight authored
      Replace the "plugin" functionality in the Guest that indirectly
      instantiates the `DocumentMeta`, `PDF` and `CrossFrame` classes with
      direct instantiation of those classes.
      
      The annotator part of the Hypothesis client is no longer a pluggable
      toolbox which can be arbitrarily extended by user-provided plugins.
      Removing the "plugins" logic and replacing it with direct construction
      of the necessary classes removes a lot of indirection that made the code
      harder to follow and also makes it easier for TypeScript to statically
      check the code. It will also enable the `config` object that is passed
      to `Guest` to be paired down to just the fields that are actually needed
      and properly typed.
      
      In future we will need some kind of plugin/integration facility to
      support different document viewers. For we will build a more specific
      document type integration facility when the time comes.
      
       - Remove `this.plugins` field from `Guest` class and `pluginClasses`
         config and replace with direct construction of `PDFIntegration`,
         `DocumentMeta` and `CrossFrame` classes
      
       - Update the `AnchoringImpl` typedef to correctly reflect that some anchoring
         implementations (HTML) have a synchronous `describe` method
      
       - Remove unnecessary `config` argument to `PDF` constructor
      
       - Replace the `PDF: {}` content in the guest config with `documentType:
         'pdf'` as a more obvious way for the annotator entry point to
         configure which document viewer integration is loaded. In future we
         can generalize this to support different types of viewer integration.
      bcd65da1
  3. 03 Mar, 2021 13 commits
  4. 02 Mar, 2021 6 commits
    • Kyle Keating's avatar
      14f4ad80
    • Kyle Keating's avatar
      Remove frontend-share subfolder · e3467f5d
      Kyle Keating authored
      - Remove github actions related to frontend-shared
      - Remove scripts and gulp commands related to frontend-shared
      - frontend-shared is now managed from its own repository.
      e3467f5d
    • Kyle Keating's avatar
      Update shared package · 4ac2b1b5
      Kyle Keating authored
      There was a version issue between the current installed version 1.4.0 and the local copy being using in the subfolder (/frontend-shared). The newest shared package exports an _index.scss file which is required by the client, but it was not formally importing a version of the shared package which exported the _index.scss file. The client now imports 1.9.0 which has _index.scss and now the frontend-shared folder can be fully removed from the client.
      
      TL;DR, This is just more reason to move the shared package to its own repo because this issue was being masked.
      4ac2b1b5
    • Robert Knight's avatar
      Fix clicking on PDF closing sidebar when side-by-side is active · f69f3803
      Robert Knight authored
      Fix a regression introduced in b52f00e0 where clicking in a PDF
      when side-by-side is active would cause the sidebar to close instead of
      remaining open. That PR made `PdfSidebar` no longer inherit (indirectly)
      from Guest but did not update the references to the `closeSidebarOnDocumentClick`
      property of the Guest.
      f69f3803
    • Robert Knight's avatar
      Remove `beforeAnnotationCreated` event handler in `DocumentMeta` · 3771ff0e
      Robert Knight authored
      This handler sets the `document` property of new annotations to metadata
      extracted from `<meta>` and `<link>` tags on the page. It is unnecessary
      however because the `Guest` class sets this property using either
      `DocumentMeta.metadata` or `PDF.getMetadata`, depending on the document
      type, before it emits the `beforeAnnotationCreated` event.
      
      In PDFs this code is a serious hazard because if the
      `beforeAnnotationCreated` event subscriber in `DocumentMeta` runs before
      `AnnotationSync`'s corresponding event handler then DocumentMeta will
      overwrite the PDF document-specific annotation metadata with generic
      HTML document metadata - losing the critical `documentFingerprint`
      property. Fortunately this problem did not occur because the `Guest`
      constructor instantiates the `AnnotationSync` class before the
      `DocumentMeta` class. Consequently AnnotationSync's
      `beforeAnnotationCreated` event handler runs before DocumentMeta's and
      pushes new annotations to the sidebar with the correct document metadata
      before `DocumentMeta` overwrites it.
      3771ff0e
    • Kyle Keating's avatar
      Fix test warnings from missing prop · 39d6e181
      Kyle Keating authored
      The ThreadList component has a required felid  `threads` but its value was undefined in tests. The value comes from the mocked version of `useRootThread.children`
      39d6e181
  5. 01 Mar, 2021 10 commits