JSFiddle - React, Tailwind, and code Playground

HTML

<div id="state"></div>
<a download="hello.txt" href="data:text/plain;base64,aGVsbG8=">download this then click on content editable</a>
<div id="editable" contenteditable="true">content editable</div>

JavaScript

document.getElementById('editable').addEventListener("click", function(){
  try {
    console.log(document.queryCommandState('bold'));
  	document.getElementById('state').textContent = 'no problem';
  } catch(e) {
  	document.getElementById('state').textContent = e;
  }
});