feat: implement text direction support#475
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/signavio/react-mentions/7VqM4FsyKw2vpQcgpwbAXAsWGKxW |
Codecov Report
@@ Coverage Diff @@
## master #475 +/- ##
==========================================
- Coverage 78.84% 78.63% -0.22%
==========================================
Files 32 32
Lines 695 702 +7
Branches 108 109 +1
==========================================
+ Hits 548 552 +4
- Misses 146 149 +3
Partials 1 1
Continue to review full report at Codecov.
|
8265bf0 to
8dedc5d
Compare
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
selectionthat is hard to achieve with multiple wrapping divs.This also solves #469