JSFiddle - React, Tailwind, and code Playground
HTML
<div contenteditable>
before<table border><td></td></table>after
</div>
JavaScript
const editingHost = document.querySelector("div[contenteditable]");
editingHost.focus();
getSelection().collapse(editingHost.firstChild, editingHost.firstChild.length);
getSelection().modify("move", "forward", "character");
document.execCommand("insertText", false, "text should be in the cell");