impr(tape mode): support RTL languages (@NadAlaba)
Description
Other than the changes made in #5868, this PR has its changes in its last commit impr(tape mode): support RTL languages (@NadAlaba) which has the following changes:
-
In
scrollTape():- Current language is await-checked if it's RTL, which requires
scrollTape()to be async. - An edit to the calculation of the current word width in tape=letter explained in point 3 below.
- In RTL, start
#wordsmargin-left by putting#wordsright edge in the center of#wordsWrapper(newMargin = - wordsEl.offsetWidth + wordsWrapperWidth/2), then put the first letter of the first word in that center (newMargin += wordRightMargin), and finally add words widths instead of subtracting them like in LTR.
- Current language is await-checked if it's RTL, which requires
-
scrollTape()becomeing async requires? it to be awaited in where it is called which requires the calling functions to become async, and the chain continues. Functions that were changed to async:- in test-ui.ts: callback in
ConfigEvent.subscribe(),updateActiveElement(),updateWordWrapperClasses(),showWords(),updateWordsMargin(), callback in#words.animate.complete()inscrollTape(). - in input-controller.ts:
backspaceToPrevious(), callback in$("#wordsInput").on("input"). - in ui.ts: callback in
debouncedEvent().
- in test-ui.ts: callback in
-
Subtract the width of the last letter that has a positive width if the current letter has a zero width (e.g, diacritics). This is needed when calculation is based on letter widths instead of letter position, which is done in caret.ts when tape=word, and in
scrollTape()when tape=letter. -
Remove restriction on RTL tape mode from test-logic.ts.
closes #3923
This PR is stale. Please trigger a re-run of the PR check action.
Weird issue i ran into when testing this (sometimes words are slow to appear on the right)
https://github.com/user-attachments/assets/3f0b64fa-8875-49d0-aa77-171266996c08
Weird issue i ran into when testing this (sometimes words are slow to appear on the right)
Resolved!
Please merge #5824 before this to perform final test on this one.
This PR is stale. Please trigger a re-run of the PR check action.
This is built on top of #5868, so it'd be easier to review that PR first
This PR is stale. Please trigger a re-run of the PR check action.
This PR is stale. Please trigger a re-run of the PR check action.
This PR is stale. Please trigger a re-run of the PR check action.