Toggle annotation/note button in multi-frame scenarios
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
Showing
Please register or sign in to comment