• 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
..
integration Loading commit data...
adder-test.js Loading commit data...
annotation-counts-test.js Loading commit data...
bucket-bar-test.js Loading commit data...
empty.html Loading commit data...
features-test.js Loading commit data...
frame-observer-test.js Loading commit data...
guest-test.js Loading commit data...
highlighter-test.js Loading commit data...
notebook-test.js Loading commit data...
range-util-test.js Loading commit data...
selection-observer-test.js Loading commit data...
sidebar-test.js Loading commit data...
sidebar-trigger-test.js Loading commit data...
toolbar-test.js Loading commit data...