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

How can I set cursor on start after focus? #28

Open
dmitrikudrenko opened this issue Oct 2, 2015 · 1 comment
Open

How can I set cursor on start after focus? #28

dmitrikudrenko opened this issue Oct 2, 2015 · 1 comment

Comments

@dmitrikudrenko
Copy link

When I call focus() a cursor stands in the end of editor. How can I stand it on start?

@mobile-dev-naveed
Copy link

I recently faced the similar issue, there are two ways to resolve it
either adding function in rich_editor.js file

RE.focusStart = function() {
RE.editor.focus();
var range = document.createRange();
range.setStart(RE.editor, 0);
range.setEnd(RE.editor, 0);
var selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
RE.editor.focus();
}

or directly calling these lines from your activity or fragment.

richEditor.requestFocus();
richEditor.loadUrl("javascript:RE.editor.focus();");
richEditor.loadUrl("javascript:RE.editor.input.setSelectionRange(0,0);");

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