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

What methods are available to control the Cursor / Caret? #175

Open
pixeline opened this issue Sep 17, 2015 · 2 comments
Open

What methods are available to control the Cursor / Caret? #175

pixeline opened this issue Sep 17, 2015 · 2 comments

Comments

@pixeline
Copy link

Hi!
Could you clarify for me what methods are actually available to control the caret or cursor position?

For instance, I thought i could use medium.cursor.moveCursorToEnd() but that throws errors.

My personal needs are to be able to place the caret at the very beginning or at the very end of the editable zone, after an ajax update of the html content.

@netolicak
Copy link

For move cursor to end or beginning you can use this:

var editor = new Medium({ ... });

// move cursor to end
editor.cursor.moveCursorToEnd(editor.element.lastChild);

// for move cursor to beginning
editor.cursor.caretToBeginning(editor.element.firstChild);

@pixeline
Copy link
Author

Thanks!

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