• Robert Knight's avatar
    Convert adder toolbar to a Preact component · 56be74d7
    Robert Knight authored
    To enable us to take advantage of the UI tooling that we built for the
    sidebar app in the "annotator" part of the client (eg. components,
    linting, testing infrastructure), we're going to convert UI components
    in the "annotator" code over to Preact as well. As a first step, this
    commit converts the "adder" toolbar that presents the "Annotate" and
    "Highlight" buttons.
    
     - Extract the logic for creating a shadow DOM root for the adder into
       a separate module (`annotator/util/shadow-root.js`) so we can re-use it for other UI
       elements in future and remove Shadow DOM v0 support since Shadow DOM v1 has
       been available for a long time now.
    
     - Replace the `adder.html` template file, manual element manipulation
       and manual event listener setup with an `AdderToolbar` Preact
       component (`annotator/components/adder-toolbar.js`), which uses the same
       tooling as components in the sidebar app
    
    In this commit the tests for all the pieces of the adder are covered by
    `adder-test.js`. Future commits will split out tests for the individual
    pieces.
    56be74d7
shadow-root-test.js 1.06 KB