• Robert Knight and Sheetal Umesh Kumar's avatar
    Show adder if user makes a selection and then launches the plugin. · 487d782e
    If a user selects some text, and then realises that Hypothesis isn't
    active, their first reaction will probably be to activate Hypothesis.
    In this scenario, we should pop up the adder near the selection on launch.
    
     * If there is a selection when the 'ready' event fires, show the adder
       at the focus point of the selection.
    
     * For consistency, show the adder at the focus point of the selection
       after a selection whilst Hypothesis is active.
    
     * Add 'range-util' module which provides utility functions to get
       the coordinates at the end of the selection.
    
       'range-util' uses the DOM Range, Selection and NodeIterator APIs directly
       rather than Annotator's Range functions for several reasons:
    
       1) Given that H now requires IE >= 10, all of our target browsers
          have all the APIs that we need.
    
       2) Using the DOM APIs directly proved easier to debug and test.
    487d782e
polyfills.js 560 Bytes