1. 16 Oct, 2020 5 commits
    • Robert Knight's avatar
      Show warning banner above PDF if there is no selectable text · d94df628
      Robert Knight authored
       - Add `documentHasText` helper in `anchoring/pdf.js` which checks if
         the document appears to have selectable text
      
       - Add logic in `plugin/pdf.js` which uses the `documentHasText` helper
         to check whether the PDF has selectable text and display a banner
         above the PDF viewer if not
      
      Fixes https://github.com/hypothesis/product-backlog/issues/1081
      d94df628
    • Robert Knight's avatar
      Remove jQuery dependency and JS bundle · 901b4eb8
      Robert Knight authored
      Following #2645 jQuery is no longer used by the Hypothesis client.
      901b4eb8
    • Lyza Danger Gardner's avatar
      Remove jQuery dependency from BucketBar · 63e2e3af
      Lyza Danger Gardner authored
      Remove jQuery dependency from BucketBar, its tests
      and other relevant modules' tests involving BucketBar.
      
      Opportunistically add some type-checking, commenting and
      other small improvements but leave general structure as-is.
      
      Increase test coverage.
      63e2e3af
    • Lyza Danger Gardner's avatar
      Refactor `Buckets` object shapes · 0b6f8b10
      Lyza Danger Gardner authored
      Previously, the `buildBuckets` function returned an
      object with two properties: `buckets` and `index`.
      
      Change to return an Array of `Bucket`s and type-define
      what a `Bucket` is—`Bucket` objects now include their
      `position` information, obviating the need for an
      `index` Array that could get out of sync.
      0b6f8b10
    • Robert Knight's avatar
      Make logic for waiting for PDFs to load work in PDF.js >= 2.5.207 · 77d30231
      Robert Knight authored
      f96af43d added support for PDF.js >= v2.5.207 by changing an event
      listener to use PDF.js's internal event bus rather than DOM events.
      However there was another DOM event listener for the `pagesloaded` event
      in `src/annotator/anchoring/pdf.js` that should also have been updated but was
      overlooked. This didn't cause a problem in testing with the dev server because
      the test documents load quickly enough that they are already loaded by the time
      the client's anchoring logic ran.
      
      This commit updates the way that the client listens for events from
      PDF.js to use the event bus where available and only fall back to the
      DOM in versions of PDF.js that don't support it.
      
       - Use PDF.js's event bus to listen for `documentload`/`documentloaded`
         and `pagesloaded` events
      
       - Add a fallback method to wait for event bus to become available in
         versions of PDF.js which support the eventBus but don't have the
         `initializedPromise` API
      
       - Improve the documentation around which versions of PDF.js support
         different event types and event dispatch methods
      
       - Add tests to cover the behavior from different releases of PDF.js
      
      For an overview of the different versions of PDF.js that the client
      needs to support, see https://github.com/hypothesis/client/issues/2643.
      77d30231
  2. 15 Oct, 2020 1 commit
    • Robert Knight's avatar
      Remove checks for IE 11 in `TagEditor` component · da788daf
      Robert Knight authored
      `TagEditor` tested if the browser was IE 11 to determine whether to
      check the `inputType` property of `InputEvent`. However it is not only
      IE 11 that did not support this property.
      
      From reading the comments in https://github.com/hypothesis/client/pull/1558 it
      appears that the `inputType` checks was originally added to resolve an
      issue with accepting suggestions by pressing Enter in an earlier version
      of `TagEditor` that used the `<datalist>` element. As far as I can tell
      this is no longer applicable. `<datalist>` was replaced by a custom UI
      and accepting suggestions by pressing Enter works without this logic.
      Therefore this commit removes it entirely.
      da788daf
  3. 14 Oct, 2020 8 commits
    • Robert Knight's avatar
      Fix `Promise.prototype.finally` polyfill loading in older browsers · 77478163
      Robert Knight authored
      The sidebar application failed to load in Safari 10 due to the ES 2018
      polyfill bundle, which contains a polyfill for
      `Promise.prototype.finally`, not being loaded in that browser.
      
      The issue was that 'es2018' was not listed in the polyfill bundles to
      build in `gulpfile.js` or in the list of bundles required by the sidebar
      app in `boot.js`.
      
      This commit fixes these issues and makes the issue less likely to occur
      in future by:
      
       - Removing the need to manually list each polyfill bundle in
         `gulpfile.js`. Instead the `src/shared/polyfills` dir is listed and
         every non-`index.js` file is used as the root of a bundle.
       - Factoring out the polyfills common to the sidebar and annotator app
         into a variable and including "es2018" there
      77478163
    • Robert Knight's avatar
      Remove `Element.closest` polyfill · 0fd302bd
      Robert Knight authored
      Element.closest is natively supported [1] by our minimum browser targets.
      
      [1] https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
      0fd302bd
    • Robert Knight's avatar
      Fix `document.evaluate` feature test in Edge Legacy · 2e6b8a6e
      Robert Knight authored
      This API is available in Edge Legacy but with a quirk that arguments
      that are optional in the spec are required in this browser.
      
      This fixes an issue that the client would incorrectly abort startup in
      Edge Legacy with a warning that the browser is unsupported.
      2e6b8a6e
    • Robert Knight's avatar
      Remove `createNodeIterator` polyfill · 7545b9a2
      Robert Knight authored
      This polyfilled the optional-ness of the `filter` and deprecated
      `expandEntityRefrences` arguments of `document.createNodeIterator` in IE
      11, which is no longer supported.
      7545b9a2
    • Robert Knight's avatar
      Remove `document.baseURI` polyfill · 93d916b8
      Robert Knight authored
      This was only needed for IE 11, which is no longer supported.
      93d916b8
    • Robert Knight's avatar
      Remove `custom-event` polyfill · c837812e
      Robert Knight authored
      This was only needed for IE 11, which is no longer supported.
      c837812e
    • Robert Knight's avatar
      Remove `document.evaluate` polyfill · 9588558a
      Robert Knight authored
      This was only needed for IE 11, which is no longer supported.
      9588558a
    • Robert Knight's avatar
      Gracefully abort startup in old browsers · e1f314b3
      Robert Knight authored
      Run a series of feature tests at the very start of the boot process and
      abort with a console warning if they fail.
      
      We display a console warning rather than a louder warning to avoid being
      disruptive on sites maintained by publishers which embed Hypothesis and
      which still want to support older browsers. On those sites the
      Hypothesis annotation feature will simply be missing.
      e1f314b3
  4. 13 Oct, 2020 9 commits
  5. 12 Oct, 2020 6 commits
  6. 09 Oct, 2020 2 commits
    • Kyle Keating's avatar
      Fix mobile cursor from jumping to bottom · 3a28eddf
      Kyle Keating authored
      When selecting text on the android, it was possible to also highlight the text inside the buttons in the adder. When this happened, the range would grab everything from where you started to highlight to the very end of the dom because the adder is attached as the last node inside body.
      
      The simple fix is to prohibit text selection inside the adder which prevents the selection from getting the adder itself.
      3a28eddf
    • Lyza Danger Gardner's avatar
      Add a non-OCR'd PDF to the dev-server documents · 150e15b9
      Lyza Danger Gardner authored
      Add a non-OCR'd PDF available to the local dev server to aid
      developers
      150e15b9
  7. 08 Oct, 2020 4 commits
  8. 07 Oct, 2020 5 commits