JSFiddle - React, Tailwind, and code Playground
HTML
<span>IE pastes at the top of the document if you have nothing selected. However, it will paste over any text that you do have selected. How do you get it to paste to the current position of the caret in a contenteditable div? </span>
<hr/>
<br />
<br />
<br />
<div id='ce' contenteditable='true'>select me...</div>
<br />
<button id='insert'>INSERT</button>
CSS
[contenteditable] {
display:inline-block;
height:100px;
width:300px;
border:1px solid black;
color:gray;
}
span {
user-select:none;
-ms-user-select:none;
}
JavaScript
document.getElementById("insert").onclick = function() {
document.selection.createRange().pasteHTML("-PASTED HTML-");
};