-
Robert Knight authored
Refactor quote anchoring logic to use async/await instead of Promise chains to make control flow easier to follow and change. - Convert `getPageOffset` and `findPage` helper functions to use async/await rather than Promise chains. - Combine the `prioritizePages` and `findInPages` functions into a single `anchorQuote` function. Combining the two functions allows some redundant work to be eliminated. `findInPages` used to call `getPageOffset` for the current page on each iteration which would in turn fetch the text of every page until it reached the given offset. `prioritizePages` would do a very similar loop in order to enumerate pages close to the given offset. - Replace use of `TextQuoteAnchor.fromSelector` with direct use of `matchQuote`. `fromSelector` wasn't providing any value over just calling `matchQuote` directly, and it required a dummy DOM element to be created and have its text populated.
d061e027