JSFiddle - React, Tailwind, and code Playground
HTML
<label for="input">Upload Photo</label>
<input id="input" type="file" accept="image/*">
<div id="output" tabindex="0" contenteditable="true">Editable Content</div>
CSS
input {
opacity: 0;
}
JavaScript
function pasteImage() {
document.getElementById("output").focus();
var reader = new FileReader();
reader.onload = function(e) {
document.getElementById("output").focus();
document.execCommand('insertImage', false, e.target.result);
}
reader.readAsDataURL(document.getElementById("input").files[0]);
}
document.getElementById("input").addEventListener('input', pasteImage);
document.getElementById("output").focus();