JSFiddle - React, Tailwind, and code Playground

HTML

<div id='did' contenteditable>some text</div>

JavaScript

var editTag = document.getElementById('did');
		editTag.addEventListener("click", function(e) {
			e.preventDefault();
			document.execCommand('insertText', false, '  foo  bar  ');			
		});