a textarea at the current caret position. Anyone have tips for
figuring out where to find this? In Flash you used to have
CaretIndex,
Im in the process of writing a code editor component, so
first off Im capturing the TAB key event, and then will insert an
actual TAB in the textarea... Right now I was just doing
this.Editor.text = this.Editor.text + ' '; But this is a stupid
stupid idea - so instead of appending it at the end, I need to
insert it in the current caret position.
Any tips would be greatly appreciated. Once I get it done, I
will be releasing it under either the Apache or GPL license.
TextArea Insertion at current Caret...
Update: I have found
var text:String = this.Editor.text;
this.Editor.text =
text.substr(0,this.Editor.selectionEndIndex) + '' '' +
text.substr(this.Editor.selectionEndIndex);
this.Editor.setSelection(this.Editor.selectionBeginIndex+1,this.Editor.selection BeginIndex+1);
No comments:
Post a Comment