Kendo Vue Editor in Classic Mode get current Cursor position in editable area

2 Answers 176 Views
Editor wrapper
Daniel
Top achievements
Rank 2
Iron
Iron
Daniel asked on 17 Dec 2021, 09:46 AM

Hello all, I am using Kendo Editor and have the below setup:

<editor :resizable-content="true"
                :resizable-toolbar="true"
                contenteditable="true"
                style="height:360px"
                rows="10"
                cols="30"
                v-model="editorBody"
                @input="setBodyOnChange"
                @keyup="setBodyOnKeyUp"
                @execute="setBodyOnExecute"
                @select="onSelect"
                ref="editor">
        </editor>

I would like to retrieve the cursor position when someone clicks in the editable area. Specifically I think I should use the select event. But I can't find a way to do so....

 

Any help would be appreciated.

2 Answers, 1 is accepted

Sort by
1
Accepted
Petar
Telerik team
answered on 17 Dec 2021, 02:13 PM

Hello Daniel,

The methods you can check are the getRange and getSelection

Here is a StackBlitz example demonstrating the usage and the results each of the two methods returns. 

You can inspect the objects each of the methods returns when you open the browser's console. Among the properties returned from the methods, there are the "offsets" that you need.

Check the linked example. I hope it will help you achieve what you need in your application.  

Regards,
Petar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Daniel
Top achievements
Rank 2
Iron
Iron
answered on 20 Dec 2021, 07:49 AM
That is what I am looking for. Thank you Petar!
Petar
Telerik team
commented on 20 Dec 2021, 08:00 AM

You are welcome!
Tags
Editor wrapper
Asked by
Daniel
Top achievements
Rank 2
Iron
Iron
Answers by
Petar
Telerik team
Daniel
Top achievements
Rank 2
Iron
Iron
Share this question
or