- 25 Nov, 2021 5 commits
-
-
Robert Knight authored
All of our target browsers now support shadow DOM [1]. Make it mandatory so it is clear that all annotator UI elements can rely on Shadow DOM and thus don't need to worry about their internal styles affecting or being affected by the host page. [1] https://caniuse.com/?search=shadow%20dom
-
Eduardo authored
Co-authored-by: Robert Knight <robertknight@gmail.com>
-
Eduardo Sanz García authored
There are two methods to get the host port from `PortProvider`: - `#hostPortFrom` which returns the host port exclusively from the `sidebar-host` channel. - `#on` allows to register a listener that is fired upon requests of host frames for channels other than the `sidebar-host`. This is an attempt to simplify the API of `PortProvider` and merge both methods into one. Advantages: - simplifies the `Sidebar` constructor signature (no need to pass the host port) - avoids the pitfall of creating host-sidebar RPC channel before registering the RPC methods - prepares for future guest-host channel see https://github.com/hypothesis/client/blob/ad93317debdac0d2c3abec83eb9d690934632ef3/src/annotator/index.js#L64-L66 (where the `#on` method is use to create the guest-host channel).
-
Eduardo authored
Co-authored-by: Robert Knight <robertknight@gmail.com>
-
Eduardo Sanz García authored
1. I converted `_setupSyncToGuest` and `_setupSyncFromGuests` into conventional class methods. 2. Added a new method, `_setupHostEvents` for sidebar-host communication. 3. Invoke these three methods above, from the constructor.
-
- 24 Nov, 2021 3 commits
-
-
Robert Knight authored
The `PortProvider._channels` map was used only to keep track of which channel requests have been handled for a particular frame. The `WeakMap<Window, MessageChannel>` was in fact used as a set rather than a map. Only the presence of entries affected behavior, not the stored MessageChannel values. Change the data structure and comments to make its purpose clearer.
-
Robert Knight authored
This comment provides general information about how MessagePorts work, but isn't directly related to any of the surrounding code. Of the two comments here, the second one is the most useful information to consumers of the PortProvider and PortFinder interfaces, but it is well covered by eg. MDN's documentation on MessagePort.
-
Robert Knight authored
Rework the code to make the code path for the sidebar-host channel more similar to other channels. As a result the `_sendPorts` helper was only called in one place and can be inlined where it is called to make the overall logic easier to follow.
-
- 23 Nov, 2021 16 commits
-
-
Lyza Danger Gardner authored
Update the `MarkdownEditor` component to use `Icon`, `IconButton`, `LabeledButton` and `Link` where relevant. Reduce complexity of local component CSS and use utility styles where possible. Extract button and link style overrides to `frontend_shared` SASS module. Part of https://github.com/hypothesis/client/issues/3876 Part of https://github.com/hypothesis/frontend-shared/issues/232
-
dependabot[bot] authored
Bumps [eslint](https://github.com/eslint/eslint) from 7.32.0 to 8.3.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v7.32.0...v8.3.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [rollup](https://github.com/rollup/rollup) from 2.60.0 to 2.60.1. - [Release notes](https://github.com/rollup/rollup/releases) - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md) - [Commits](https://github.com/rollup/rollup/compare/v2.60.0...v2.60.1) --- updated-dependencies: - dependency-name: rollup dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.16.0 to 7.16.4. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.16.4/packages/babel-preset-env) --- updated-dependencies: - dependency-name: "@babel/preset-env" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1028.0 to 2.1034.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.1028.0...v2.1034.0) --- updated-dependencies: - dependency-name: aws-sdk dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) from 7.27.0 to 7.27.1. - [Release notes](https://github.com/yannickcr/eslint-plugin-react/releases) - [Changelog](https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md) - [Commits](https://github.com/yannickcr/eslint-plugin-react/compare/v7.27.0...v7.27.1) --- updated-dependencies: - dependency-name: eslint-plugin-react dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [reselect](https://github.com/reduxjs/reselect) from 4.1.2 to 4.1.4. - [Release notes](https://github.com/reduxjs/reselect/releases) - [Changelog](https://github.com/reduxjs/reselect/blob/master/CHANGELOG.md) - [Commits](https://github.com/reduxjs/reselect/compare/v4.1.2...v4.1.4) --- updated-dependencies: - dependency-name: reselect dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.4.4 to 4.5.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.4.4...v4.5.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 6.14.3 to 6.15.0. - [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/6.14.3...6.15.0) --- updated-dependencies: - dependency-name: "@sentry/browser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [karma](https://github.com/karma-runner/karma) from 6.3.8 to 6.3.9. - [Release notes](https://github.com/karma-runner/karma/releases) - [Changelog](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md) - [Commits](https://github.com/karma-runner/karma/compare/v6.3.8...v6.3.9) --- updated-dependencies: - dependency-name: karma dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-
dependabot[bot] authored
Bumps [@hypothesis/frontend-shared](https://github.com/hypothesis/frontend-shared) from 4.1.0 to 4.3.0. - [Release notes](https://github.com/hypothesis/frontend-shared/releases) - [Changelog](https://github.com/hypothesis/frontend-shared/blob/main/CHANGELOG.md) - [Commits](https://github.com/hypothesis/frontend-shared/compare/v4.1.0...v4.3.0) --- updated-dependencies: - dependency-name: "@hypothesis/frontend-shared" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-
Eduardo Sanz García authored
The current version of `isSourceWindow` raised an error for (1) older browser that doesn't support ServiceWorker and (2) web pages served from non-secured http connections. I tested this alternative fix but it didn't work for me in the latest version of Chrome: https://stackoverflow.com/questions/6229301/a-clean-way-of-checking-whether-an-object-is-an-instance-of-window-constructor/6229603#6229603
-
Eduardo Sanz García authored
In future PR, `Guest` will contain two bridges (like `FrameSync`). Naming them by the destination frame will help identify the purpose of it. It seems that the convention for this `Bridge`s is to contain the word `RPC` to indicate that it is a remote (inter-frame) procedure.
-
Eduardo Sanz García authored
-
Eduardo Sanz García authored
This adoption simplifies the discovery of frames. I did a little bit of clean-up in the tests: rearranged a few variables alphabetically, and delete unneeded lines and variables.
-
Robert Knight authored
This includes a fix for incorrect results under certain conditions when the pattern length is an exact multiple of 32. See https://github.com/robertknight/approx-string-match-js/pull/13.
-
- 22 Nov, 2021 7 commits
-
-
Eduardo Sanz García authored
In future PR, `Guest` will contain two bridges (like `FrameSync`). Naming them by the destination frame will help identify the purpose of it. It seems that the convention for this `Bridge`s is to contain the word `RPC` to indicate that it is a remote (inter-frame) procedure.
-
Eduardo Sanz García authored
-
Eduardo Sanz García authored
This adoption simplifies the discovery of frames. I did a little bit of clean-up in the tests: rearranged a few variables alphabetically, and delete unneeded lines and variables.
-
Eduardo Sanz García authored
The tests crashed if either of these commands was executed: - `yarn test --grep anchoring`, or - `yarn test --grep 'anchoring/test/pdf|test/integration/anchoring'` `src/anotator/anchoring/test/pdf-test.js` cleanup the Viewer by setting the `window.PDFViewerApplication' to `null`. After that, if another test created a `Guest` instance (like `src/annotator/test/integration/anchoring-test.js`) will think that the document is a PDF and will crash. This is the code that checks if the document is a PDF: https://github.com/hypothesis/client/blob/492ab6d56a5685356ca6b3a48644e047bb28dca0/src/annotator/integrations/pdf.js#L53-L56 The solution is either deleting `window.PDFViewerApplication' or setting it to `undefined`.
- 19 Nov, 2021 1 commit
-
-
Eduardo Sanz García authored
We use `Window` objects as keys on a map. Windows can be removed. `WeakMap` has the characteristic that keys that are claimed by the garbage collector are removed from the map. In this way, we are memory friendly and don't retain any defunct object.
-
- 17 Nov, 2021 5 commits
-
-
Robert Knight authored
-
Robert Knight authored
Create a test page for PDF-based VS books, using content adapted from https://bookshelf.vitalsource.com/reader/books/9781938168239/, an OpenStax textboot that is available for free [1] in VitalSource. - Rename vitalsource.mustache => vitalsource-epub.mustache to make the distinction with the PDF example clearer. - Create vitalsource-pdf.mustache which serves as the "container" page for a PDF-based VS book. This is a copy of vitalsource-epub.mustache with the Prev/Next buttons removed and slight terminology changes ("chapter" => "page") to reflect how PDFs are handled in VS - Revise the descriptive text at the top of the VS PDF and EPUB examples to explain the purpose more clearly and relate them to how books are presented in the Bookshelf store, where the terms "reflowable" and "fixed" are used instead of "EPUB" and "PDF". - Add a very lightly edited copy of a real content page from a VS book in vitalsource-pdf-page.mustache. This is the HTML content from the iframe displaying a page in a PDF book in VS. The only changes I have made are small block of CSS customizations at the top (see comment) and a change to the URL of the rendered PDF page. - Update the links to the VitalSource test pages on the dev server. [1] Even though the book is free, you have to add it to your VitalSource book library before you can access it. To do that, go to https://bookshelf.vitalsource.com and search for the book ID (9781938168239 in this case), then click "Open Book".
-
Eduardo Sanz García authored
Following these two comments: * https://github.com/hypothesis/client/pull/3929/files#r750399422 * https://github.com/hypothesis/client/pull/3929/files#r750414036 I am proposing in this PR to remove the anti-collision field `authority` from the message that is send to discover frames. I believe the message contains enough information to avoid to be confused by other unrelated `postMessage` in the host frame.
-
Eduardo authored
Co-authored-by: Robert Knight <robertknight@gmail.com>
-
Eduardo Sanz García authored
For PortFinder, I followed this advice: https://github.com/hypothesis/client/pull/3881#discussion_r743030606, except that I made the argument of `PorFinder#discover` and string (instead of an object). ``` const portFinder = new PortFinder({ source: 'guest', hostFrame }); portFinder.discover('sidebar'); portFinder.discover('host'); ``` For PortProvider, I followed this advice: https://github.com/hypothesis/client/pull/3881#discussion_r743033013, except that I used a getter. ``` cont portProvider = new PortProvider(...) const bridge = new Bridge(); bridge.createChannel(portProvider.sidebarPort); ``` I have renamed the properties of `Message`: - `source` becomes `authority` - `channel` and `port` have been replaced by `frame1` and `frame2` I did that to align `port1` and `frame1` and `port2` and `frame2`, while also avoiding clashing with other names (`source`, `target`) which have other meaning in the `window.postMessage` context. I have removed one level of nesting in the `PortProvider#discover` that make the method more readable. I added some other suggestions from PR #3881.
-
- 15 Nov, 2021 3 commits
-
-
Eduardo authored
Co-authored-by: Robert Knight <robertknight@gmail.com>
-
Eduardo Sanz García authored
This new method allows to unregister individual event listeners.
-
dependabot[bot] authored
Bumps [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) from 6.4.1 to 6.5.1. - [Release notes](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/releases) - [Changelog](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/CHANGELOG.md) - [Commits](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/compare/v6.4.1...v6.5.1) --- updated-dependencies: - dependency-name: eslint-plugin-jsx-a11y dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
-