spiegel-keyman/web/source/dom/targets
Marc Durdin b05fda1c6a fix(web): selection direction and tests
Selection direction was not maintained in mutations, which could have
unexpected consequences. Added support for selection direction to input
and textarea.

The functions `getTextBeforeCaret()` and `getTextAfterCaret()` are named
somewhat incorrectly, as they actually get the text before and after the
active selection (and a collapsed zero-length selection is equivalent to
the caret). It would be worth renaming these in a future refactor.

This PR fixes the unit tests so that caret position is tested correctly
with an active selection -- the caret can be at either the start or the
end of the selection, corresponding with the direction in which the user
originally selected the text. It also fixes the assumptions around the
above named functions for `input` and `textarea` types.

Note that selection interactions are still buggy with prediction
selections; these bugs were present in 15.0.118-alpha and I will tackle
them in an upcoming commit.
2022-02-23 15:13:07 +11:00
..
contentEditable.ts fix(web): properly handle selection 2022-02-23 15:12:58 +11:00
designIFrame.ts fix(web): properly handle selection 2022-02-23 15:12:58 +11:00
input.ts fix(web): selection direction and tests 2022-02-23 15:13:07 +11:00
outputTarget.ts refactor(web): OSK connection to active element 2021-09-01 09:44:00 +07:00
readme.md refactor(web/engine): moves DOM-based OutputTargets to own namespace 2020-03-26 10:05:47 +07:00
textarea.ts fix(web): selection direction and tests 2022-02-23 15:13:07 +11:00
touchAlias.ts fix(web): properly handle selection 2022-02-23 15:12:58 +11:00
wrapElement.ts refactor(web): adds intermediate DOM-aware OutputTarget abstraction 2020-04-03 10:31:35 +07:00

Please keep any code in this folder / namespace as free as possible from dependencies on other parts of KMW. Some of our unit tests wish to run against these types without requiring KMW to be active.

Note that with a little work, we could completely spin this into its own separate module - this could be useful for development and testing purposes... at least, save for the TouchAlias type.