• Eduardo Sanz García's avatar
    Toggle annotation/note button in multi-frame scenarios · b802451d
    Eduardo Sanz García authored
    In order to toggle correctly the `Toolbar` button between `New page
    note` and `New annotation` we have created a new `guest-host` channel of
    communication. Previous code failed to toggle the button because it used
    an event emitter, hence assuming that the `Guest` was in the same frame
    as the host.
    
    - The `Sidebar` keeps track of the iframe that has currently text
      selected. It uses the `subFrameIdentifier`. If there is no
      `subFrameIdentifier` (currently the top `Guest` frame), it sets the
      identifier to 'main', referring to the frame with the main annotatable
      content. This will change in a follow up PR that will add more logic
      into which frame is tagged as 'main'.
    
    - Only one iframe at a time can have selected text.
    
    - The event emitter `hasSelectionChanged` has been replaced by three RPC
      methods: 'textSelectedAt`, 'textDeselectedAt', 'deselecTextExcept'
    
    - `deselecTextExcept` is used to clear text selections in other frames,
      except from the iframe that has the latest selection. This is not the
      neatest solution, but for now it works.
    
    On a follow up PR I will address the removal of the shadow left from
    previous a selection.
    
    Closes https://github.com/hypothesis/product-backlog/issues/1236
    b802451d
Name
Last commit
Last update
.github Loading commit data...
bin Loading commit data...
dev-server Loading commit data...
docs Loading commit data...
embedding-examples Loading commit data...
images Loading commit data...
requirements Loading commit data...
scripts Loading commit data...
src Loading commit data...
.babelrc Loading commit data...
.dockerignore Loading commit data...
.eslintignore Loading commit data...
.eslintrc Loading commit data...
.gitignore Loading commit data...
.npmignore Loading commit data...
.npmrc Loading commit data...
.prettierignore Loading commit data...
.python-version Loading commit data...
CODE_OF_CONDUCT Loading commit data...
Dockerfile Loading commit data...
Jenkinsfile Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
codecov.yml Loading commit data...
gulpfile.mjs Loading commit data...
package.json Loading commit data...
pyproject.toml Loading commit data...
requirements-dev.in Loading commit data...
rollup-boot.config.mjs Loading commit data...
rollup-tests.config.mjs Loading commit data...
rollup.config.mjs Loading commit data...
tox.ini Loading commit data...
tsconfig.json Loading commit data...
yarn.lock Loading commit data...