- 20 Nov, 2020 15 commits
-
-
Robert Knight authored
Both are functionally equivalent in this code, but we're using `Object<K,V>` elsewhere, so prefer that for consistency.
-
Robert Knight authored
This doesn't serve a purpose any more since the arguments are now values rather than promises.
-
Robert Knight authored
-
Robert Knight authored
-
Robert Knight authored
-
Robert Knight authored
Ensure that the `describe` function in `anchoring/pdf.js` fails with a useful error if the passed range includes text outside of the PDF page's text layer. In this case `getNodeTextLayer` will return `null` and existing code in `describe` will throw to indicate the range starts or ends outside of the text layer. This will help to avoid the confusion that arose in https://github.com/hypothesis/client/issues/1464. This behavior is still not really useful from the end user's point of view, but at least the error is better. Improving the actual behavior will come later.
-
Robert Knight authored
-
Robert Knight authored
This has been replaced by the `TextRange.toRange` method in `text-range.js`. The test cases are covered by the tests for `TextRange` and `TextPosition`.
-
Robert Knight authored
The PDF anchoring code was using several different dependencies to to handle converting between ranges and text positions, as well as normalizing ranges to that they start and end in text nodes. This commit simplifies the picture by converting the PDF anchoring code to use only the `TextRange` and `TextPosition` classes for these purposes. - Change the PDF anchoring code to use the `TextRange` and `TextPosition` classes to handle converting a DOM range into text offsets in `describe` - Change the PDF anchoring code to use `TextRange` to handle resolving a (start, end) pair of character offsets within a page to a `Range` - Improve the type information for several related functions within the PDF anchoring code
-
Robert Knight authored
Try to explain the issue with `textContent` in a better way.
-
Robert Knight authored
`Node.textContent` has a quirk where it does not count text in comments or processing instructions when called on an `Element` but does return the comment / processing instruction data if called directly on a `Comment` or `ProcessingInstruction` node. To make conversion between `Range`s and `TextRange`s consistent in both directions we need to always ignore text in comments/processing instructions.
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Robert Knight authored
There is a difference between an empty selection and no selection at all. In the latter case APIs such as `selection.getRangeAt(0)` will throw an error.
-
Robert Knight authored
Content in a PDF's annotation layer, such as link annotations, can interfere with text selection and also cause creating annotations to fail [1]. This commit resolves the problem by temporarily hiding annotation layers when there is a non-empty selection. This allows the user to select text inside link annotations (for example) while still enabling the user to activate the link normally when there is no selection. Fixes https://github.com/hypothesis/client/issues/1464 [1] This is because the annotation layer is outside the text layer and the PDF anchoring code expects the selection to be within the text layer.
-
- 18 Nov, 2020 2 commits
-
-
Robert Knight authored
Optimize the case where `toRange` is used to resolve (start, end) offsets within the same element by only iterating over nodes in the element once, instead of iterating separately to resolve the start and end points.
-
Robert Knight authored
Add a method that converts a text position within an element to one where the offset is relative to some ancestor element. This operation will be needed for replacing existing Range => (element, start, end) conversions with a single one based on `TextRange` and `TextPosition`.
-
- 16 Nov, 2020 15 commits
-
-
Lyza Danger Gardner authored
This is the first version of Chrome that supports CSS Grid without a flag. Fixes #2739
-
Robert Knight authored
Following PR feedback split a parametrized test into three separate tests for ease of understanding. Also rename `previousSiblingTextLength` to `previousSiblingsTextLength` to clarify that it includes _all_ of the previous siblings of the node, not just one.
-
Robert Knight authored
After resolving an annotation's selectors to a `Range`, convert the range to a `TextRange` object which is stored with the anchor and later resolved to a concrete `Range` just before inserting highlights. Representing the anchored region using a `TextRange` allows for the correct text to be highlighted later if the region has been modified as a result of inserting other highlights, providing that the text content of the region has not been changed. Fixes https://github.com/hypothesis/h/issues/3278 Fixes https://github.com/hypothesis/client/issues/2326 Fixes https://github.com/hypothesis/h/issues/5997
-
Robert Knight authored
Add a `TextRange` class which represents a region of the document as an immutable start/end pair of (element, text position) points. Compared to a DOM `Range`, this representation of a document region is more robust to changes in the DOM structure of the region that don't affect the text content, such as wrapping parts of the range in elements to insert accessible highlights.
-
Robert Knight authored
Without the explicit annotation the type of `position` is inferred as `string` rather than `"relative"|"static"`.
-
dependabot-preview[bot] authored
Bumps [preact](https://github.com/preactjs/preact) from 10.5.5 to 10.5.7. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](https://github.com/preactjs/preact/compare/10.5.5...10.5.7) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
-
dependabot-preview[bot] authored
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 5.27.3 to 5.27.4. - [Release notes](https://github.com/getsentry/sentry-javascript/releases) - [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-javascript/compare/5.27.3...5.27.4) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
-
dependabot-preview[bot] authored
Bumps [codecov](https://github.com/codecov/codecov-node) from 3.8.0 to 3.8.1. - [Release notes](https://github.com/codecov/codecov-node/releases) - [Changelog](https://github.com/codecov/codecov-node/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-node/compare/v3.8.0...v3.8.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
-
dependabot-preview[bot] authored
Bumps [autoprefixer](https://github.com/postcss/autoprefixer) from 10.0.1 to 10.0.2. - [Release notes](https://github.com/postcss/autoprefixer/releases) - [Changelog](https://github.com/postcss/autoprefixer/blob/master/CHANGELOG.md) - [Commits](https://github.com/postcss/autoprefixer/compare/10.0.1...10.0.2) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
-
dependabot-preview[bot] authored
Bumps [postcss](https://github.com/postcss/postcss) from 8.1.6 to 8.1.7. - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/master/CHANGELOG.md) - [Commits](https://github.com/postcss/postcss/compare/8.1.6...8.1.7) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
-
dependabot-preview[bot] authored
Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.787.0 to 2.792.0. - [Release notes](https://github.com/aws/aws-sdk-js/releases) - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js/compare/v2.787.0...v2.792.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
-
dependabot-preview[bot] authored
Bumps [eslint](https://github.com/eslint/eslint) from 7.12.1 to 7.13.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v7.12.1...v7.13.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
-
Robert Knight authored
-
Robert Knight authored
-
Robert Knight authored
Fix a bug that could cause pieces of text to be highlighted twice rather than once. For this bug to occur: 1. The anchored range had to start in the middle of a text node 2. The anchored range had to end _after_ the text node, so that the range's `commonAncestorContainer` property pointed to an ancestor of the text node In this scenario, the `wholeTextNodesInRange` function would split the text node where the range started and add the piece on the right-hand side of the split to the list of text nodes to wrap in highlight elements. The `forEachNodeInRange` iterator would then visit the right-hand text node a _second_ time because it is the _next node_ it its iteration order. This resulted in the text node being added twice to the `textNodes` list returned by `wholeTextNodesInRange`. To resolve this, rewrite the loop in `wholeTextNodesInRange` so that it visits each text node in the range only once, even if the node is split mid-iteration. In doing so a small optimization was made by setting the `NodeIterator`'s filter to `NodeFilter.SHOW_TEXT` in order to skip any non text nodes.
-
- 13 Nov, 2020 4 commits
-
-
Lyza Danger Gardner authored
Handle and rebroadcast events in Sidebar to support the opening and closing of the Notebook. Show option in user menu if feature flag is enabled.
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
-
Lyza Danger Gardner authored
Add env NOTEBOOK_APP_URL and support for it in build and config for annotator.
-
- 12 Nov, 2020 4 commits
-
-
Robert Knight authored
Make some small improvements in response to PR feedback.
-
Robert Knight authored
Add additional tests for `highlightRange` calls that requires splitting text nodes in order to wrap only the part inside the range. This turned up an edge case with handling collapsed ranges that start (and end) in the middle of a text node.
-
Robert Knight authored
Decouple `highlightRange` from the `NormalizedRange` class and make it work with ordinary DOM ranges. This decouples the highlighter implementation from the range wrapper types, which will make some future changes to highlighting easier.
-
Robert Knight authored
`isNodeInRange` in range would throw an exception if the passed node had no parent because `range.selectNode(...)` requires its argument to have a parent. This commit rewrites `isNodeInRange` to use `range.comparePoint` which avoids creating a temporary live range and handle exceptions that `comparePoint` may throw. It also updates the JSDoc to more accurately describe what the function does.
-