Select some text and click to buttons.
<!-- api buttons -->
<button onclick="$R('#content', 'selection.save');">Save</button>
<button onclick="$R('#content', 'selection.restore');">Restore</button>
<!-- element -->
<textarea id="content"></textarea>
<!-- call -->
<script>
$R('#content');
</script>