JSFiddle - React, Tailwind, and code Playground
HTML
<div contenteditable><b>bolder text</b></div>
JavaScript
let editor = document.getElementsByTagName("div")[0];
editor.focus();
let selection = document.getSelection();
selection.collapse(editor, 1);
document.execCommand("insertText", false , "normal text");