Here's a plugin for the textarea field that adds a function insertAtPosition(text) to add some text at the cursor position. Hopefully this is helpful to someone.

Just add "plugins:new InsertAtCursorTextareaPlugin()" to the textarea's config object.

PHP Code:
/**
 * Copyright Intermesh
 *
 * This file is part of Group-Office. You should have received a copy of the
 * Group-Office license along with Group-Office. See the file /LICENSE.TXT
 *
 * If you have questions write an e-mail to info@intermesh.nl
 *
 * @version $Id: InsertAtCursorTextareaPlugin.js 2353 2009-04-15 11:05:51Z mschering $
 * @copyright Copyright Intermesh
 * @author Merijn Schering <mschering@intermesh.nl>
 */

Ext.namespace("Ext.ux"); 
Ext.ux.InsertAtCursorTextareaPlugin = function (){
    return {
        
init : function(textarea){
            
textarea.insertAtCursor = function(v) {
                if (
Ext.isIE) {
                    
this.el.focus();
                    var 
sel document.selection.createRange();
                    
sel.text v;
                    
sel.moveEnd('character',v.length);
                    
sel.moveStart('character',v.length);
                }else
                {
                    var 
startPos this.el.dom.selectionStart;
                    var 
endPos this.el.dom.selectionEnd;
                    
this.el.dom.value this.el.dom.value.substring(0startPos)
                    + 
v
                    
this.el.dom.value.substring(endPosthis.el.dom.value.length);

                    
this.el.focus();                
                    
this.el.dom.setSelectionRange(endPos+v.length,endPos+v.length);
                }
            }
        }
    }
};