ueberdosis / tiptap

The headless rich text editor framework for web artisans.
https://tiptap.dev
MIT License
27.36k stars 2.27k forks source link

Set direction of the text automatically (For RTL text) #3085

Open mokazemi opened 2 years ago

mokazemi commented 2 years ago

What problem are you facing?

I can't use the editor for Right-to-Left languages, because there's no option for it. So the editor is only limited to English and other Left-to-Right languages.

What’s the solution you would like to see?

There are some ways to set text direction automatically. For example this area that I'm writing in (Github text area!) has this feature. So when I write something in a RTL languages, it's displayed correctly.

image

image

What alternatives did you consider?

There could at least be a button for it like some Word Processors such as Google Docs, like this: image

But some text editors such as Github text area doesn't have it, but set the direction automatically.

Anything to add? (optional)

I'm facing this problem in the Nextcloud Editor

Are you sponsoring us?

mustafa-online commented 2 years ago

This is the only missing part that keeping me from using Tiptap.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days

mustafa-online commented 1 year ago

+1

hadifarnoud commented 1 year ago

+1

avivdaniel commented 1 year ago

+1

mustafa-online commented 1 year ago

Any updates?

amirhhashemi commented 1 year ago

This is what you are looking for: https://github.com/amirhhashemi/tiptap-text-direction

I made a PR to add this feature a while ago but the core team didn't seem very interested. Maybe because they are not familiar with a RTL language.

bdbch commented 1 year ago

@mokazemi @amirhhashemi yes we (or at least I am) inexperienced with RTL languages and I think I personally could improve here.

Could you point me to the PR regarding this issue? I'd be interested if we can implement support without breaking existing Extensions.

amirhhashemi commented 1 year ago

@bdbch This is the original PR: https://github.com/ueberdosis/tiptap/pull/2963 It's a little out-dated but I can update if you are interested. I haven't tested it in a real project yet but theoretically it shouldn't break any existing extension.

If you want to test the latest version checkout this repo: https://github.com/amirhhashemi/tiptap-text-direction. It's pretty much the same thing but I fixed some bugs and added more stuff.

yousefhalabi commented 1 year ago

@amirhhashemi thanks for the extension, i can confirm it works on vue3 and saved me a lot of the trouble cheers!

coderyeasin commented 1 year ago

@amirhhashemi Thank you! for developing this man, I'm facing some problems with this plugin and I'm using nextjs. I can't write Arabic (so I don't know if when writing Arabic, it changes direction or not) , but when I paste something inline it will take RTL and click enter if I paste again Arabic text it will also take RTL, so kind of good for that but the real problem is when i paste multiple Arabic lines its make only first-line direction(RTL), others line are taking LTR. so how can I resolve it with styles that can you explain please see this pic Screenshot from 2023-04-13 01-46-12

amirhhashemi commented 1 year ago

@coderyeasin Thank you for reporting this. I opened an issue in the main repo: https://github.com/amirhhashemi/tiptap-text-direction/issues/8

Please refer to that for further follow-up