RadEditor cursor position reset after press Enter

5 posts, 0 answers
  1. ahmet
    ahmet avatar
    2 posts
    Member since:
    May 2011

    Posted 25 Feb 2013 Link to this post

    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



  2. Nikolay
    Admin
    Nikolay avatar
    94 posts

    Posted 27 Feb 2013 Link to this post

    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.
  3. ahmet
    ahmet avatar
    2 posts
    Member since:
    May 2011

    Posted 27 Feb 2013 Link to this post

    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
  4. Nikolay
    Admin
    Nikolay avatar
    94 posts

    Posted 28 Feb 2013 Link to this post

    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.
  5. Elvis
    Elvis avatar
    11 posts
    Member since:
    Jul 2008

    Posted 18 Mar 2013 Link to this post

    Like a Pro!
Back to Top