Make the whole document editable.

Here’s a small cool trick to make the whole document editable.

document.designMode = 'on';

This can also be used with iframes, i.e.

let iframeNode = document.getElementById('myeditor'); // or any other ways to get reference to an iframe
iframeNode.contentDocument.designMode = "on";

Try this out with the current page by clicking here!