JSFiddle - React, Tailwind, and code Playground
by sstur
HTML
<div id="editable">
<p>This is a ContentEditable region. Paste some text here. If holding the shift key during paste, it will paste plain-text only!</p>
</div>
CSS
#editable {
-webkit-user-modify: read-write;
}
JavaScript
var div = document.getElementById('editable');
document.addEventListener('keydown', function(e) {
if (e.keyIdentifier === 'Shift') {
div.style.webkitUserModify = 'read-write-plaintext-only';
}
});
document.addEventListener('keyup', function(e) {
if (e.keyIdentifier === 'Shift') {
div.style.webkitUserModify = 'read-write';
}
});