Damn, it took a long time to figure out how to insert text into a textarea at the current cursor position. Like three years ;) Finally found this.