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

replace text on position of caret

1 Answer 68 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Wilco
Top achievements
Rank 1
Wilco asked on 28 Oct 2015, 01:00 PM

Hi,

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: http://dojo.telerik.com/igabu/12  

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!

Regards,

Wilco

 

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 30 Oct 2015, 07:25 AM
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.

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