views:

104

answers:

0

Hello,

I would like to be able to put the cursor wherever I want inside an instance of YUI SimpleEditor. The problem is that I am using setEditorHTML after every keystroke and the cursor moves to the beginning of the text every time. Different commands in YUI do it already but I don't want to have to create a command for it if possible.

The solution approved here doesn't work for me because createTextRange or selectionStart are not properties of the simple editor.

My code looks like this:

this.on('editorKeyUp', function(ev)
{
    var content = this.getEditorHTML();

    // ...some text manipulation here...

    var finalHTML = content.replace(text1, text2);

    this.setEditorHTML(finalHTML);
}, this, true);

Any ideas?

Thanks for your help!