• 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
..
anchoring Loading commit data...
components Loading commit data...
config Loading commit data...
integrations Loading commit data...
test Loading commit data...
util Loading commit data...
.eslintrc.js Loading commit data...
adder.js Loading commit data...
annotation-counts.js Loading commit data...
bucket-bar.js Loading commit data...
features.js Loading commit data...
frame-observer.js Loading commit data...
guest.js Loading commit data...
highlighter.js Loading commit data...
hypothesis-injector.js Loading commit data...
icons.js Loading commit data...
index.js Loading commit data...
notebook.js Loading commit data...
range-util.js Loading commit data...
selection-observer.js Loading commit data...
sidebar-trigger.js Loading commit data...
sidebar.js Loading commit data...
toolbar.js Loading commit data...