feat: implement text direction support #475
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds new functionality to allow RTL text in react-mentions. Under normal circumstances, you can achieve this via CSS
direction: rtl
, however, the problem with that is that you need to know which direction is going to be used up front or you need to detect it from the textarea value on change. However, HTML supportsdir="auto"
as attribute on any element that enabled auto detection by the browser.In our use case, we have a textarea where we expect RTL and LTR text to appear at the same time - you first add the text in your RTL language and then you add Engligh below it. This means we need text direction per paragraph of text. We take this approach everywhere but now we would like to allow mentioning, so we are looking into react-mentions for the functionality.
I called the prop unstable, because I don't thinks it complete and it needs to be improved, but I need help with this by someone who knows the library a bit more. One problem will be a
selection
that is hard to achieve with multiple wrapping divs.This also solves #469