This is a migrated thread and some comments may be shown as answers.

javascript function 'getSelectedElement()' which returns the entire underlying HTML element in relation to the cursor position in ajax editor

1 Answer 140 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 17 May 2013, 04:40 PM
In the asp.net ajax editor there is a convenient javascript function
'getSelectedElement()' which returns the entire underlying HTML element in
relation to the cursor position.  There appears to be no equivalent
feature in the kendo editor.  Before i resort to digging into the sources
of the ajax editor, i was wondering if the same thing can be achieved for the
Kendo editor using the existing API?

 

getRange() and selectedHtml() seem to be relevant, but there is very little documentation
on how getRange() works and what the available node parameters are.

 

Can anyone
offer a convenient solution?

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 21 May 2013, 11:47 AM
Hi Martin,

 
Basically there is no exact equivalent of the function that you pointed, however you can get the selected element using getSelection method and jQuery:

var selectedElement = $($("#editor").data("kendoEditor").getSelection().focusNode).parent()

Also more information about the Range and Selection objects can be found on W3C site.

Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Editor
Asked by
Martin
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or