1. 05 Mar, 2021 3 commits
    • 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
  2. 03 Mar, 2021 13 commits
  3. 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
  4. 01 Mar, 2021 16 commits
  5. 26 Feb, 2021 2 commits
    • Robert Knight's avatar
      Fix PDF side-by-side mode not activating · 4f2c69df
      Robert Knight authored
      The `ToolbarController#getWidth` method started incorrectly returning 0
      after 243c06d3. This commit moved the
      content of the toolbar to a child of `ToolbarController._container` and
      the `getWidth` method was not updated accordingly.
      
      The incorrect result of `this.toolbar.getWidth()` in `Sidebar` later
      resulted in an incorrect calculation of the sidebar's width and caused
      `PdfSidebar` to think that the window was too narrow to support
      side-by-side mode.
      
      Fix the problem by updating `ToolbarController#getWidth` so that it
      returns the correct value again.
      4f2c69df
    • Lyza Danger Gardner's avatar
      c60b9fd1