JSFiddle - React, Tailwind, and code Playground
by tomprogramming
HTML
<div>
<span class="content_replaceable">This is some text in a span</span>
</div>
CSS
div {
-webkit-user-modify:read-write;
border:1px dashed #900;
padding:10px;
margin:10px;
}
.content_replaceable {
display:inline-block;
position:relative;
min-width:10px;
}
.content_replaceable::after {
display:block;
content:" ";
width:5px; height:5px;
position:absolute;
bottom:0;
right:0;
background-color:#900;
}
JavaScript
document.execCommand("styleWithCSS", true);
$("div").on("keypress", function(e){
if (e.which === 13){
document.execCommand("insertLineBreak");
e.preventDefault();
e.stopPropagation();
}
});