replace text on position of caret

2 posts, 0 answers
  1. Wilco
    Wilco avatar
    3 posts
    Member since:
    Apr 2015

    Posted 28 Oct 2015 Link to this post


    We'd like to achieve to replace defined keywords with html (text). we are able to insert at the caret position the html. But we have difficulties to remove the typed keyword. We've tried to simulate the backspace key triggerd by jQuery but it didn't work out well. We've tried to get the value from the editor and use the carrot position to remove/update the keyword. ​The caret position is related to the plain text value instead of the html value. With an existing html formatted text it fails. but we cannot use a regex replace because we dot not want to alter the text typed before.

    A dojo:  

    type 'test' press space and the keyword should be replaced by the given value. (item). 


    Possible solutions would be: 

    - remove last X typed characters. / trigger backspace.

    - remove X characters from caret position (related to html value)

    - ... ?


    Any help is appreciated!




  2. Alex Gyoshev
    Alex Gyoshev avatar
    2497 posts

    Posted 30 Oct 2015 Link to this post

    Hello Wilco,

    I'm afraid that there is no client-side editor method that offers such functionality. The API for interacting with the editor content is limited to getting a range object via the getRange method and interacting with its methods.

    Alex Gyoshev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top