рони,
<textarea id="text"></textarea>
<button id="zzz">ctrl+Z</button>
<button id="yyy">ctrl+Y</button>
<script>
text.oninput = e => {
text.blur();
text.focus();
};
zzz.onclick = e =>document.execCommand('undo');
yyy.onclick = e => document.execCommand('redo');
</script>