JSFiddle - React, Tailwind, and code Playground

HTML

<iframe id="editor" style="border: none; position:absolute; top:0; left:0; right:0; bottom:0; width:100%; height:100%">

</iframe>

JavaScript

var editor = $('#editor').contents().find('body');

$('#editor').contents().prop('designMode', 'on');

editor.append("<p>Test <b>bold</b> text</p>");

editor.on("click", function(event) {
  console.log("clicked:" + $(event.target).prop("tagName") );
});

editor.on("keyup", function(event) {
  console.log("key:" + $(event.target).prop("tagName"));
});