JSFiddle - React, Tailwind, and code Playground

HTML

<style>
iframe {border: 1px solid #0D6AB7; background: #fff}
</style>

<p>
    <button onclick="format('bold')">Tučně</button>
    <button onclick="format('italic')">Kurzíva</button>
    <button onclick="format('StrikeThrough')">Škrtnout</button>
    <button onclick="alert(getContent())">Zobrazit HTML</button>
    <button onclick="insertText()">insertText</button>
</p>

<iframe id="editor" class="editor" frameborder="0"></iframe>

<script>
var editor, iframe;
window.onload = function() {
    iframe = document.getElementById("editor");
    editor = iframe.contentWindow.document;
    editor.designMode = "on";
}

function format(akce) {
    iframe.contentWindow.focus();
    editor.execCommand(akce, false, null);
}

function getContent() {
    return editor.body.innerHTML;
}

function insertText() {
    iframe.contentWindow.focus();
    editor.execCommand("insertText", false, "<code class=\"style\"></code>");
}
</script>