Commit graph

218 commits

Author SHA1 Message Date
Joshua A. Horton
64037c0832 feat(web): content editable editing for touch 2022-09-29 08:17:49 +07:00
Joshua A. Horton
5d74d89e2c chore(web): better blur-event swallowing 2022-09-29 08:17:48 +07:00
Joshua A. Horton
fe585b88af chore(web): removal of 'kmw_ip' checks, references 2022-09-29 08:17:47 +07:00
Joshua A. Horton
7b498d60e1 chore(web): missed some spots 2022-09-29 08:17:46 +07:00
Joshua A. Horton
dfca726cf1 chore(web): fully removes touch-alias stuff 2022-09-29 08:17:45 +07:00
Joshua A. Horton
7bf29cecfd change(web): disconnects touch alias hooks, adds .inputMode 2022-09-29 08:17:44 +07:00
Joshua A. Horton
0bbc3e7375 chore(web): reverts accidental branch creep 2022-09-27 08:59:56 +07:00
Joshua A. Horton
be6bf141c1 fix(web): vscode merge got in the way 2022-09-22 15:46:49 +07:00
Joshua A. Horton
dce7ef74b2 fix(web): fixes for non-focus-related unit-test breaks 2022-09-22 15:44:56 +07:00
Marc Durdin
3977ffda2f fix(web): remove spurious log "No keyboard stubs exist"
This error has been logged for every start of Keyman Engine for Web in
embedded contexts, but nothing bad ever happens. It does not really seem
to be anything we need to worry about. (It may be that the
`setDefaultKeyboard()` call will never return true, but it is still
harmless in any case.)
2022-07-05 15:36:21 +10:00
jahorton
50656722bb change(web): implements arrow-func desired in #6551 comment 2022-06-14 14:52:01 +07:00
jahorton
f600406192 fix(web): reverts a change that broke on Android API 21 2022-05-31 09:11:20 +07:00
jahorton
082d96a605 chore(web): roots MSevent refs 2022-05-31 09:11:19 +07:00
jahorton
00c717371f chore(web): roots _GetEventObject 2022-05-31 09:11:18 +07:00
jahorton
0abf33829a chore(web): roots out _IsIEEditableIframe 2022-05-31 09:11:17 +07:00
jahorton
858f9bc8fa chore(web): roots out many IE-related blocks 2022-05-31 09:11:17 +07:00
jahorton
eb62bcb7ee chore(web): rips out document.createEvent 2022-05-31 09:11:16 +07:00
jahorton
0df5ff44b6 change(web): removes mspointerevent refs 2022-05-31 08:27:15 +07:00
Marc Durdin
fcf78bcd94 chore: merge master into branch 2022-05-27 13:11:23 +10:00
jahorton
7990cdc1dd feat(web): caret placement fine-tuning 2022-04-25 11:53:36 -05:00
jahorton
509fbb02e8 change(web): clarifies caret positioning logic 2022-04-25 11:18:02 -05:00
jahorton
efcc4276a3 change(web): performCaretSearch now member of TouchAliasElement 2022-04-25 09:25:13 -05:00
jahorton
56b4c5ac50 fix(web): caret position when page is scrolled 2022-04-20 15:28:35 -05:00
jahorton
d3900fce47 docs(web): documents some optimizing blocks 2022-04-20 15:06:32 -05:00
jahorton
a355f2ecff chore(web): minor polish 2022-04-20 15:05:03 -05:00
jahorton
48fb1371c0 docs(web): better comments & var naming 2022-04-20 15:02:57 -05:00
jahorton
94edc5c9da fix(web): mobile device caret positioning 2022-04-20 14:52:33 -05:00
jahorton
1c394c2744 change(web): further clarifies performCaretSearch 2022-04-20 13:03:32 -05:00
jahorton
cd666d0346 fix(web): major performance boost, fixes search bound logic bug 2022-04-20 12:29:00 -05:00
Marc Durdin
0ac04d0530 chore(web): Merge branch 'beta' into chore/web/no-more-lerna 2022-04-12 21:17:15 +10:00
Marc Durdin
4d94786852 chore(web): replace lerna with npm workspaces and ts projects
Fixes #6320.

Part 1 of moving from lerna to a simpler, maintained monorepo solution,
using TypeScript Projects and NPM Workspaces.

There is more work to be done here. At this point, KeymanWeb builds and
runs without errors, but the built file is substantially different,
mostly in include order.

Using TypeScript Projects, we move away from the need to run build
scripts in various locations for almost all the Typescript modules.

TODO: Embedded versions and tests have not been verified.

TODO: developer/server is not yet verified.

TODO: developer/js (needs a rename!) is not yet verified.

TODO: Currently, the predictive-text folder needs refactoring to move
the construction of the worker wrapper out of the Predictive Text build
and into the final assembly of keymanweb.js (as it should be valid to
run it as a separate .js anyway).

TODO: Most of the `<reference>` paths need to be re-verified. Ideally
there should be no references outside the current module for any given
.ts.

TODO: The embedded vs browser vs node (headless) builds should be tidied
up for consistency so that it's obvious what depends on what. This is
currently messiest in the predictive-text folder, where the output names
diverge from the filenames and the various files are mixed in the same
folder (as evidenced by the exclusions listed in each tsconfig.json).

TODO: `npm install` should be removed from most build scripts and
instead `npm ci` (#6196) should be run only once from the top-level
folder for any given build. I've had eliminated side-effects from the
`install` action for npm, which makes it easier to reason about state.

TODO: verify_npm_setup and related functions can probably be eliminated.

TODO: most of the build scripts should be largely eliminated for web.

TODO: several ts projects use inconsistent output folders.

TODO: it may be possible to generate a .d.ts for models/types so that
we can use a consistent reference for those as well.

TODO: build.sh, tsconfig.json should always be in the module's top-level
folder, not in a subfolder such as src (e.g. see input-processor/src,
keyboard-processor/src, web/source).

TODO: resources/web-environment should be in common/web.

TODO: other js node_modules imports should be wrapped like es6-shim.

TODO: fix up the publish code for npm modules

TODO: eliminate version numbers from package.json if possible?

Whew, that's most of the stuff I noticed!
2022-04-12 21:02:33 +10:00
Marc Durdin
49eb062c65 feat(web): prediction casing follows current layer
Fixes #6455.

This involved adding an extra hint to the data passed into the lexical
model layer, being the CasingForm that the current layer wants to use.

Given there are several entry points to the lexical model layer, this
meant a few places where we needed to check the current layer.

I refactored the very long function `InputProcessor.processKeyEvent` to
extract out the `buildAlternates` function. There should be no
functional changes to the `buildAlternates` code. But it makes
`processKeyEvent` significantly easier to read.
2022-04-08 16:14:01 +10:00
Marc Durdin
e616900cad
Revert "feat(web): prediction casing follows current layer" 2022-04-08 14:50:32 +10:00
Marc Durdin
b7ce99480f feat(web): prediction casing follows current layer
Fixes #6455.

This involved adding an extra hint to the data passed into the lexical
model layer, being the CasingForm that the current layer wants to use.

Given there are several entry points to the lexical model layer, this
meant a few places where we needed to check the current layer.

I refactored the very long function `InputProcessor.processKeyEvent` to
extract out the `buildAlternates` function. There should be no
functional changes to the `buildAlternates` code. But it makes
`processKeyEvent` significantly easier to read.
2022-04-01 16:20:50 +11:00
Marc Durdin
88ffb8bbd2 fix(web): adjust touch alias element positioning
Fixes #5942.

The touch alias element position was not consistent across all browsers,
leading to misalignment in some situations. Identified missing CSS to
make the positioning consistent, as far as I can tell, which led to the
additional benefit of reducing the per-browser special cases.
2022-03-22 08:38:12 +11:00
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
Marc Durdin
cacbbee5cc fix(web): properly handle selection
Relates to #5853 and others.

Selection management was not working properly with the various
OutputTargets:

1. When there is a non-empty selection, rules have no context -- it's
   like new text.
2. Backspace over a selection deletes just the selection.
3. Typing a character replaces the selection, of course, and collapses
   the caret to the end of the new text.
4. `hasSelection` is a very strange name for `OutputTarget` descendants.
   It doesn't mean "has an active selection" but rather, kinda means
   "supports selection internally".
5. Added `isSelectionEmpty` which is used for some of the new selection
   rules above.

Note that the `touchAlias` OutputTarget class does not currently support
selection. I hope we can deprecate `touchAlias` with the use of
`inputMode` (#3030) in the future, rather than adding support for
selection.
2022-02-23 15:12:58 +11:00
Marc Durdin
ac2cc93f2a fix(web): add readonly mode for rule behavior finalization
Relates to #5853.

Two things happened here:

1. Construction of Mocks made an assumption that the selection should
   always be deleted (outputTarget.ts:363). However, for NewContext and
   PostKeystroke processes, we don't want to change anything.

2. Even if nothing is changed, the transcription would emit what is
   in theory a no-op ruleTransform (insert="", deleteLeft=0,
   deleteRight=0). But apps would treat this as deleting the selection.

This fix goes a little broader than I would have preferred, but adds a
readonly mode to the transcription and mock model, so that we can
control explicitly when changes are applied to the text store.
2022-02-22 10:42:20 +11:00
Marc Durdin
0c0bb420b5
Merge pull request #5963 from keymanapp/feat/web/3621-newcontext-group
feat(web): Start of Sentence support - part 1 🕊
2022-01-17 12:04:29 +11:00
Marc Durdin
3f35cc0bf8 chore(web): Merge branch 'master' into feat/web/3621-newcontext-group 2021-11-29 10:22:22 +11:00
Marc Durdin
e98930dedb
Merge branch 'master' into fix/web/5779-font-scaling-in-osk 2021-11-29 09:12:15 +11:00
Marc Durdin
45821fcb1b fix(web): adjust tablet font scaling
This makes two corrections:

1. Removed an obsolete test for screen size based on dpi, which is
   unreliable, meant that we had been treating many Android tablets as
   phones (domManager.ts).
2. Font scale for Android tablets had some incorrect assumptions around
   keyboard height and devicePixelRatio, which I was able to simplify
   into a fixed ratio, and was much better across all devices I
   tested (however, all emulated in Chrome).
2021-11-29 08:56:41 +11:00
Marc Durdin
d6982898a8 fix(web): restore dragEnd function
Relates to #5947.

I resolved a merge conflict in #5947 in the wrong direction and
accidentally deleted the `dragEnd` function. This restores it.
2021-11-29 07:40:04 +11:00
Marc Durdin
c7b83f9f1f
Merge branch 'master' into fix/web/5944-save-focus-for-eurolatin-osk 2021-11-29 06:35:53 +11:00
Marc Durdin
f300e81381
Merge branch 'master' into fix/web/5909-shorten-setfocustimer 2021-11-24 07:11:34 +11:00
Marc Durdin
dcedb15b69 chore: cleanup comments and defines 2021-11-23 16:08:19 +11:00
Marc Durdin
bbbf1afce7 feat(web): basic support for newContext
Relates to #3621.

Adds basic support for `begin newContext`.
2021-11-23 15:00:47 +11:00
Marc Durdin
9162d575ce fix(web): support saving focus for custom OSK interactions
Fixes #5944.

If a custom OSK, such as sil_euro_latin, calls `keymanweb.KSF()` or
`keymanweb.saveFocus()`, this ensures that the next focus change is
ignored, which prevents the OSK from being dismissed as soon as it is
clicked on.

This is a regression, probably arising in version 10.0.

Note: `_SelectionChange` is no longer used or referenced, so I removed
it as part of this fix.
2021-11-19 12:58:53 +11:00
Marc Durdin
cceb2f35b5 fix(web): shorten setFocusTimer()
Fixes #5909.

The `setFocusTimer()` delay was 1000ms. However, it seems that a much
shorter delay accomplishes the same outcome for switching between
controls, as the important factor is to block asynchronously-arriving
events from cancelling the OSK / focus controls for touch alias
elements.

I have set the delay to 50ms. This is fast enough that a click in a
control followed by a click on the page area will always cancel the OSK,
but gives the space needed for queued focus/blur events have time to be
processed before cancelling the timer.
2021-11-19 11:22:21 +11:00
Marc Durdin
c2c7e00e94 fix(web): reset scroll anchor on touchend
Fixes #5313.
2021-11-17 10:37:01 +11:00