New to Kendo UI for AngularStart a free 30-day trial

Moving the Cursor of the Editor to the Beginning

Environment

ProductProgress® 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:

  1. 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.

    ts
        editor.view.state.selection.$cursor.pos = 0;
  2. Utilize the focus method of the ProseMirror library to focus the component.

    ts
    editor.view.focus();

    Prior to v16.3.0 of the Editor package, use built-in focus method to focus the component.

The following example demonstrates how to position the cursor of the Editor at the beginning.

Change Theme
Theme
Loading ...
In this article
EnvironmentDescriptionSolutionSuggested Links
Not finding the help you need?
Contact Support