Ankur Aggarwal Ankur Aggarwal - 7 months ago 45
Javascript Question

Change focus to particular para in medium editor (github)

How to change the position of cursor to particular para in medium editor. I am able to fetch node of the target para but unable to relocate cursor. Tried

but its not working. Also tried
) but it highlights the whole para, didn't move the cursor. Any help on this? Just a beginner to editor. Thanks in advance


So found out the solution for this. MediumEditor provides method for this

MediumEditor.selection.moveCursor(document, element, 0);

It doesn't works on if editor is blur (In that case you need to focus the editor first and then use this method)