Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any plans for RTL (right to left) support? #450

Closed
BrianJVarley opened this issue Jul 23, 2020 · 14 comments
Closed

Any plans for RTL (right to left) support? #450

BrianJVarley opened this issue Jul 23, 2020 · 14 comments
Labels
Milestone

Comments

@BrianJVarley
Copy link

BrianJVarley commented Jul 23, 2020

Hi @JiHong88 , the editor is impressive and covers nearly all of our requirements. But I don't see a config option for RTL (right to left) text direction in the editor.

Is this something on the roadmap or already existing option? (I didn't see this in the docs). The rtl configuration is defined as..

In a right-to-left, top-to-bottom script (commonly shortened to right to left or abbreviated RTL), writing starts from the right of the page and continues to the left. This can be contrasted against left-to-right writing systems, where writing starts from the left of the page and continues to the right.
Arabic, Hebrew, Pashto, Persian, Urdu, and Sindhi are the most widespread RTL writing systems in modern times.

Example Toolbar button on other editor:

rtl-editor

Configuration Example:
image

@JiHong88
Copy link
Owner

Hi @BrianJVarley
Thank for your suggestion.
I'll add RTL option and button to next version.

@JiHong88 JiHong88 added this to the 2.33.0 milestone Jul 31, 2020
@BrianJVarley
Copy link
Author

BrianJVarley commented Jul 31, 2020

Hey JiHong88. Looking at the RTL support on different editors, the RTL button seems to be a common approach to flipping the editor content direction. But another thing to consider is order and direction of toolbar buttons.

When I've tested in this editor an other that support RTL fully. You can see that certain toolbar icons are re-ordered and flipped backwards on language change to arabic: (see bold, italic, strikethrough format buttons and toolbar labels)

arabic-direction-rtl

@JiHong88 will the upcoming implementation of RTL include flipping and re-organising toolbar icons? In addition to flipping the editor content that I mentioned originally. I think the Material Docs give a good explanation of the different factors for icons.

image

@JiHong88 JiHong88 modified the milestones: 2.33.0, 2.34.0 Aug 31, 2020
JiHong88 added a commit that referenced this issue Aug 31, 2020
@BrianJVarley
Copy link
Author

@JiHong88 I see the commit above for RTL. Is this available to test on a public released version? c43b5c5

@JiHong88
Copy link
Owner

JiHong88 commented Sep 9, 2020

@BrianJVarley I will upload it to the test server.
Check and giving me feedback will help for develop.

@BrianJVarley
Copy link
Author

BrianJVarley commented Sep 11, 2020

@JiHong88 sure, How can I check this change on the test server? Is there a link to access it?

@JiHong88
Copy link
Owner

@BrianJVarley I'll notify you at the this week after update.

@JiHong88
Copy link
Owner

Hi, @BrianJVarley
I uploaded RTL options under development.
It is still being modified.
Modal window, the title at the bottom of the toolbar, and the table selector are being modified.

Please tell me know if there are any further modifications to be made.
Ex) Image modify box, etc...

http://suneditor.com/test/index.html

@BrianJVarley
Copy link
Author

BrianJVarley commented Sep 18, 2020

Hi @JiHong88 I tested the RTL feature above. The editor contents alignment and text typing direction look great for RTL.
But I notice some bugs with toolbar button direction, label direction and dropdown lists contents. When I compare it to this editor implementation of RTL - https://ckeditor.com/ckeditor-4/demo/(To test RTL change browser language to Arabic).

Here is some feedback on RTL feature that I think will improve it. I think if you can make the below changes it will make RTL feature it will be more complete:

  • Toolbar Dropdown Menus (Format, Size, Font, Paragraph Style, Text Style, Line Height, Align): These toolbar button dropdown menus contents / text should be LTR (left aligned), because contents are still in English and Numbers. Currently the text is backwards which isn't correct. Also the ▼ icon on dropdown menu should display on left side of button text:

dropdown-menus-toolbar

  • Icon Direction: In RTL only some icons should be reversed. I have highlighted in green icons that should be reversed, also highlighted in red icons should not be reversed i.e, same as LTR mode:

suneditor-icon-direction

  • Ordering of Icons: These icons should be ordered as, [Italic, Underline, Bold] the reverse of LTR mode. Also icons should not be flipped backwards. They should be same direction as LTR mode.

bold-italic-underling-button

undo-redo-btn

  • Toolbar Labels: Because toolbars labels are still in English, they should still read LTR. Currently, they are backwards.

label-backwards-toolbar

  • Image Modify Box: URL input text should be LTR not RTL because URL is still LTR regardless of language, Submit button should be left side of modal, close (x) button should
    be left side of modal. "Link" and "Image" tab text should be normal LTR as its English text. Tab should be on right side of modal.

image-modal-rtl

JiHong88 added a commit that referenced this issue Sep 21, 2020
@JiHong88
Copy link
Owner

@BrianJVarley I updated to the test page.
And please comment on these components.

1
2
3

Also the color picker is modified
4

@BrianJVarley
Copy link
Author

BrianJVarley commented Sep 21, 2020

@JiHong88 The above changes look correct apart from some changes to icon order (should be reverse order for RTL). A good test to verify RTL is implemented correctly is to open Google Docs and change keyboard language to Arabic to check what toolbar options change.

I do notice some minor bugs on label and toolbar buttons as follows. I think the following changes would improve RTL feature further:

  1. Undo / Redo button: These buttons should be pointing same direction as in LTR mode. SO non change to icon, (left arrow = undo, right arrow - redo) See correct implementation here:

undo-redo-example

  1. Indent / Out-dent button: The English part of the label here is backwards, should be LTR:

indent-outdent-label

  1. Link Button: should be mirrored:
    Undo / redo, more buttons: should be placed on left side of editor:

ltr-feedback

  1. Image Insert Dialog: These button positions should differ from LTR mode (the same way as it was implemented for the general toolbar) – just reverse button positions:

image-insert-rtl

  1. Table Insert DIalog: These button positions should differ from LTR mode (the same way as it was implemented for the general toolbar) – just reverse button positions:

table-dialog-rtl

@impulsgraw
Copy link

impulsgraw commented Sep 22, 2020

Hi @JiHong88 ,

Since some time I keep an eye on your wonderful wysiwyg library, it's really great!
I consider the RTL support as a must-have in modern content editors, it's amazing you've decided to implement it for the SunEditor.
The suggestions from @BrianJVarley are quite precise 👍 .
During the implementation of RTL feature in my project I have found the following resources as comprehensively informative to refer to:

Several useful suggestions:

  • Following things should always remain LTR (as they don't have RTL equivalents): phone numbers (including all signs), URLs, email addresses, date&time (unless it's in the Arabic/Hebrew traditional format); although the text alignment anyway should always reflect the text direction -- for ex. the URL in the long text-input should be LTR, but aligned to the right. One can consider such small pieces as foreign LTR "aliens" inside the outer RTL context.
  • The default RTL locales for most languages (Arabic, Hebrew, Urdu) in the widely-used regular fonts (Times, Arial, Helvetica, etc) are quite poor and either just not intended for such purposes, or just appear unreadable for native speakers. Consider the example below -- such tooltip label has very small Arabic letters.
    image
    So I think it's better to reconsider the font-family. I have found the Noto Sans family as the great alternative.
  • BTW, on the screenshot with the tooltip above, the string slices are misaligned towards to each other: if in English you see something like "Shortcut description (Ctrl+F5)" then in Arabic you should see "(F5+Ctrl) Shortcut description" -- the part in the round braces moves from the string ending into the beginning (and vice-versa).

Don't hesitate to reach out in case of questions!
I'll try to have some more walkthrough meantime,

Thanks,
Andrey.

JiHong88 added a commit that referenced this issue Oct 4, 2020
modify: options.rtl > direction,
fix: list style
JiHong88 added a commit that referenced this issue Oct 4, 2020
JiHong88 added a commit that referenced this issue Oct 5, 2020
JiHong88 added a commit that referenced this issue Oct 10, 2020
JiHong88 added a commit that referenced this issue Oct 10, 2020
JiHong88 added a commit that referenced this issue Oct 15, 2020
JiHong88 added a commit that referenced this issue Oct 15, 2020
JiHong88 added a commit that referenced this issue Oct 15, 2020
JiHong88 added a commit that referenced this issue Oct 15, 2020
@JiHong88
Copy link
Owner

@BrianJVarley @impulsgraw
I updated RTL mode of the test page. http://suneditor.com/test/index.html

The creation of all controllers and tables has also been modified with RTL.
And the list of align buttons has been modified so that the right sort is at the top by default.

At the bottom of the test page is a list of buttons used when creating the editor.
I created a button module by reversing the order of the button list in RTL mode, but I am not sure if it is the correct operation.

And.. I'm confused if the Math plugin should also be RTL.

JiHong88 added a commit that referenced this issue Oct 18, 2020
@JiHong88
Copy link
Owner

@BrianJVarley @impulsgraw
The 2.34.0 version has been updated.
If this issue has not been resolved, please reopen this issue.
Thank you.

@BrianJVarley
Copy link
Author

BrianJVarley commented Oct 19, 2020

@JiHong88 great! I'll take a run through your linked test page this week to verify. @impulsgraw what's your thoughts on this latest RTL release?

I do see three things that could be addressed on RTL feature:

  • Toolbar Arabic label text: It's very small, take a look at indent / outdent buttons. Maybe a different font here such as Andrei suggested could be more legible. Such as - https://www.google.com/get/noto/

  • Toolbar Short Cut Text English: On the indent and outdent toolbar buttons the shortcut text is not clear, I can't read which shortcut combination that is. Is there any way you can use a different font or use more whitespace?

image

  • Toolbar bold icon: The icon should not be flipped, currently its backwards. Can you position the bold icon normally the same as LTR? So for example..'B'

image

RTL User Function:
On a different note, I think there is a benefit to exposing a "User Function" for the RTL prop similar to editorInstance.enabled();. At the moment we would have to re-create the editorInstance in order to update rtl mode at runtime. But if you exposed an editorInstance.rtl.enable() editorInstance.rtl.disable() it would allow the client to update to RTL mode dynamically when browser locale is changed to Arabic language.

Is this something you have considered as an enhancement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants