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

RadEditor cursor position reset after press Enter

4 Answers 86 Views
Editor
This is a migrated thread and some comments may be shown as answers.
ahmet
Top achievements
Rank 1
ahmet asked on 25 Feb 2013, 01:58 PM
Hello
this is my first post. Actually whole days i search for smilar thread on the forum but all contents are related 
editor.getSelection().getRange() gives current location of cursor! yes this gives but if press enter contentArea divided and nodes are like
Facebook
Google
innerHTML is like 'Facebook<br>Google' innerText is like 'FacebookGoogle'
so if cursor located to end of 'google'
then $find("RadEditor1").getSelection().getRange().endOffset = 6 and $find("RadEditor1").getSelection().getRange().
startContainer.data='Google'
if content is like  'Facebook Google' then $find("RadEditor1").getSelection().getRange().endOffset = 15 and $find("RadEditor1").getSelection().getRange().startContainer.data='Facebook Google'

i want cursor location gives position for whole content not for current line and if possible i d like to get current node of contentArea nodes which divided by new line or line breaks



4 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 27 Feb 2013, 04:56 PM
Hi Ahmet,

Straight to the point: You can use the editor.getSelectedElement() function to get the HTML element where the cursor position is.


All the best,
Nikolay
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
ahmet
Top achievements
Rank 1
answered on 27 Feb 2013, 05:33 PM
Hi again,
2 days later replied my question and you just said it can be taken where the cursor is 
do you understand what i ask? 
of course i know how to get cursor position but cursor position reset if i press enter and ContentBody divided nodes 

ok i want remove string "De" until first match of " " and cursor located end of string " Turkey De" 

Turkey Istanbul Bakirkoy
Turkey De

dont forget cursor position not whole text length it is only "Turkey De".length 
if content not contain line break cursor position d be whole text length

thanks again
0
Nikolay
Telerik team
answered on 28 Feb 2013, 04:55 PM
Hello Ahmet,

The aim of the telerik Support Forum is to provide all registered users a way to find answers to their questions before contacting telerik. You can also use them to: 
  • discuss coding techniques with fellow telerik users 
  • share your experience on the telerik suite of controls 
  • contact telerik with a question 
  • ask general questions, not related to telerik controls 
  • contact telerik's MVPs 
  • help other users.

A post in the Support Forums doesn't guarantee you a response from the telerik support team although 95% of all posts are eventually answered. Additionally, a post is not assigned a response time as with the support ticketing system. In case you need a faster and precise response, please start a new support ticket as it gets higher priority than Forum posts.

As I understand you now, you need the textNode where the cursor is and the cursor position in this textNode?
Unfortunately, RadControls do not provide such functionality. You can use the RadEditor instance, document, window and range objects, to write your own implementation.
I would also recommend you to take a look on the following articles:

Kind regards,
Nikolay
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Elvis
Top achievements
Rank 2
answered on 18 Mar 2013, 03:05 PM
Like a Pro!
Tags
Editor
Asked by
ahmet
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
ahmet
Top achievements
Rank 1
Elvis
Top achievements
Rank 2
Share this question
or