JSFiddle - React, Tailwind, and code Playground

HTML

<div id="p" contenteditable="true">
<div>line 1</div>
</div>

JavaScript

var p = document.getElementById("p");
p.focus();
document.execCommand("selectAll");
document.execCommand("indent");