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

[Feature Request] RTL support #12

Open
HassanHeydariNasab opened this issue Aug 4, 2015 · 2 comments
Open

[Feature Request] RTL support #12

HassanHeydariNasab opened this issue Aug 4, 2015 · 2 comments

Comments

@HassanHeydariNasab
Copy link

Please add RTL support !
Thanks

@wasabeef
Copy link
Owner

wasabeef commented Sep 3, 2015

@HassanHeydariNasab

i want to pull-request..

@manee1982
Copy link

manee1982 commented Feb 21, 2023

@HassanHeydariNasab Yes indeed. It would be very nice if RTL is supported in this great project.

I've figure out a solution to support RTL by Extending RichEditor class and add 'setDirectionTo' method:

public class CustomRichEditor extends RichEditor {
    public CustomRichEditor(Context context) {
        super(context);
    }

    public CustomRichEditor(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomRichEditor(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public void setDirectionTo(String dir) {
        String direction = "(function() {" +
                "    var body  = document.getElementsByTagName(\"body\")[0];" +
                "    body.dir = \"" + dir + "\";" +
                "}) ();";
        exec("javascript:" + direction + "");
    }
}

XML code:

<your.package.name.CustomRichEditor
            android:id="@+id/theID"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="50dp"/>

Thanks in advance @wasabeef

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

3 participants