Moving the Cursor of the Editor to the Beginning
Environment
Product | Progress® Kendo UI® for Angular Editor |
Description
How to move the cursor of the Editor to the beginning?
Solution
The Editor view
exposes the ProseMirror EditorView instance and thus provides access to the current Editor state and selection.
To move the position of the cursor to the beginning of the Editor:
- Use the selecion $cursor that returns a resolved position and set the value of its position property to 0 in order to move the position of the Editor's cursor to the beginning.
editor.view.state.selection.$cursor.pos = 0;
-
Utilize the built-in
focus
method to focus the component.this.editor.focus();
The following example demonstrates how to position the cursor of the Editor at the beginning.