This example shows how to use API for inserting text or HTML at the caret.
<!-- api buttons -->
<button onclick="$R('#content', 'insertion.insertText', '<p>...</p>');">Text</button>
<button onclick="$R('#content', 'insertion.insertHtml', '<p>...</p>');">HTML</button>
<!-- element -->
<textarea id="content"></textarea>
<!-- call -->
<script>
$R('#content');
</script>