JSFiddle - React, Tailwind, and code Playground

HTML

<div contenteditable>
<br>
</div>

JavaScript

let editor = document.querySelector("div");
editor.addEventListener("focus", () => {
  setTimeout(() => {
    let counter = 0;
    editor.addEventListener("input", event => {
      if (++counter < 100) {
        document.execCommand("insertText", false, `, ${counter}`);
      }
    });
    document.execCommand("insertText", false, "0");
  }, 0);
});
window.focus();
editor.focus();