JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id='text'></textarea>
<button id='button'>press me</button>
JavaScript
Ext.get('button').on('click', update);
function update(){
var myTextArea = Ext.getDom('text')
,textInArea = myTextArea.value
,textToInsert = '???'
,caretPosition = myTextArea.selectionStart;
myTextArea.value = textInArea.substring(0, caretPosition)
+ textToInsert + textInArea.substring(caretPosition);
}