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

Add Right-to-Left (RTL) support #4569

Open
rakeshkumar1019 opened this issue Jan 16, 2025 · 2 comments
Open

Add Right-to-Left (RTL) support #4569

rakeshkumar1019 opened this issue Jan 16, 2025 · 2 comments

Comments

@rakeshkumar1019
Copy link

Issue Description

Request: Add Right-to-Left (RTL) support for text direction in Quill editor.

Details: As a user who works with languages that are written from right to left, such as Arabic or Hebrew, I would like to see RTL text direction support integrated into Quill. This feature would greatly enhance usability and accessibility for users who rely on RTL languages, ensuring a seamless writing experience.

Expected Behavior:

  • Text alignment and direction should automatically switch to RTL when typing in RTL languages.
  • UI controls (e.g., toolbar icons) should adjust their layout and orientation for RTL support.

Additional Context:

  • Quill currently lacks native RTL support, which poses usability challenges for users writing in RTL languages.
  • Other text editing tools and libraries already offer RTL support, making it an essential feature for global usability.

Impact: Enhancing Quill with RTL support would broaden its accessibility and appeal to a wider audience of users who prefer or require RTL text direction. This update aligns with the goal of making Quill more inclusive and user-friendly across diverse linguistic contexts.

@Juicetan
Copy link

Isn't it supported already?

var DirectionStyle = Quill.import('attributors/style/direction');
DirectionStyle.whitelist = ['ltr','rtl'];
Quill.register(DirectionStyle, true);

@rakeshkumar1019
Copy link
Author

Isn't it supported already?

var DirectionStyle = Quill.import('attributors/style/direction');
DirectionStyle.whitelist = ['ltr','rtl'];
Quill.register(DirectionStyle, true);

@Juicetan , Thank you for your reply.With above provided configuration:

  • ordered (ol) and unordered (ul) lists exhibit unexpected behavior in RTL mode (e.g., alignment, indentation, or marker placement issues).
  • Attached are the reproduction code and a screenshot highlighting the problem. Let us know if further details are needed to resolve this!

Image

<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Quill Editor with Direction Control</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.snow.css" rel="stylesheet">
    <style>
        #editor-container {
            max-width: 800px;
            margin: 20px auto;
        }
        .ql-direction {
            padding: 8px 12px !important;
        }
    </style>
</head>
<body>
    <div id="editor-container">
        <div id="toolbar">
            <span class="ql-formats">
                <select class="ql-header">
                  <option value="1"></option>
                  <option value="2"></option>
                  <option value="3"></option>
                  <option value="4"></option>
                  <option value="5"></option>
                  <option value="6"></option>
                  <option selected></option>
                </select>
              </span>
              <span class="ql-formats">
                <button class="ql-bold" ></button>
                <button class="ql-italic" ></button>
                <button class="ql-underline" ></button>
                <button class="ql-strike"></button>
              </span>
              <span class="ql-formats">
                <button class="ql-blockquote" ></button>
                <button class="ql-code-block" ></button>
                <button class="ql-indent" value="-1" ></button>
                <button class="ql-indent" value="+1" ></button>
              </span>
              <span class="ql-formats">
                <button class="ql-align" value="" ></button>
                <button class="ql-align" value="center" ></button>
                <button class="ql-align" value="right" ></button>
              </span>
              <span class="ql-formats">
                <select class="ql-color" ></select>
                <select class="ql-background" ></select>
              </span>
              <span class="ql-formats">
                <button class="ql-script" value="sub"></button>
                <button class="ql-script" value="super" ></button>
              </span>
              <span class="ql-formats">
                <button class="ql-list" value="ordered" ></button>
                <button class="ql-list" value="bullet" ></button>
              </span>
              <span class="ql-formats">
            
        </div>
        <div id="editor" style="height: 300px;"></div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.js"></script>
    <script>
        var DirectionStyle = Quill.import('attributors/style/direction');
        DirectionStyle.whitelist = ['ltr', 'rtl'];
        Quill.register(DirectionStyle, true);
        var quill = new Quill('#editor', {
            modules: {
                toolbar: {
                    container: '#toolbar',
                },
            },
            direction: 'rtl', 
            theme: 'snow'
        });
    </script>
</body>
</html>

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

No branches or pull requests

2 participants