finding focus of cursor in radeditor

624 views Asked by At

I am using radeditor in my project. I want the text which is immediate after the cursor position or immediate before the cursor position.

I can set html using editor.pasteHtml("html") but how can I get the text before or after that position?

1

There are 1 answers

2
Rumen Jekov On

In short you should create a range in the content area of RadEditor

var range = editor.getSelection().getRange();

and obtain the content selection. Try the solution provided in this forum thread: pasteHtml After Node at Cursor Position?.

You can find additional information about the ranges in these articles:

http://www.wrox.com/WileyCDA/Section/JavaScript-DOM-Ranges-Page-2.id-292302.html http://www.quirksmode.org/dom/range_intro.html http://msdn.microsoft.com/en-us/library/ms535872%28VS.85%29.aspx

Once you create a range in the editor, you can use the GetCaretPosition function from this thread: JavaScript get word before cursor