mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-13 00:56:05 +08:00
### Description 1. refactor: - store (language direction / state of direction reversing funbox) in test-state.ts, and set them on `TestLogic.init()` which is called on each restart which happens on each change of Config.language or funbox. - use these new direction variables in (caret.ts / test-ui.ts / pace-caret.ts /result-word-highlight.ts) instead of calling `await JSONData.getCurrentLanguage(Config.language)`. 2. css changes: - add `unicode-bidi: bidi-override;` to .words with ligatures in backwards to fix the direction of LTR words on LTR languages in custom tests (which now have `.withLigatures` class regardless of language). - remove `direction: rtl;` from right to left .word and keep it on right to left #words. This was done because after adding the above `bidi-override`, (.word)s directioin was being forced to rtl on tests with RTL language and RTL words (custom and none custom tests), which is wrong (should be ltr on those tests because of the backwards funbox). - P.S., removing this from .word does not affect normal tests, because .word direction is inherited from #words directtion on non .withLigatures tests (e.g, non custom tests in non withLigatures languages), and it is calculated using internal browser algorithm based on characters used in .withLigatures tests (tests in languages with ligatures and all custom tests). 3. add the property "reverseDirection" to backwards funbox, which signifies that the direction of the test should be the reverse of the direction of Config.language, and the direction of a word should be the reverse of `Strings.isWordRightToLeft()`. 4. allow backwards funbox to work on languages with ligatures. 5. move `void Caret.updatePosition()` call to after the call of `TestUI.lineJump()` in `input-controller.ts:handleSpace()`. 6. change name of `Strings.getWordDirection()` to `Strings.isWordRightToLeft()` which explains what does the returned boolean mean, and add a parameter `reverseDirection` that flips the final result if true. --------- Co-authored-by: Miodec <jack@monkeytype.com> |
||
---|---|---|
.. | ||
__test__ | ||
src | ||
.eslintrc.cjs | ||
.oxlintrc.json | ||
package.json | ||
tsconfig.json | ||
tsup.config.js | ||
vitest.config.ts |