JSFiddle - React, Tailwind, and code Playground

by Comandeer

HTML

<div contenteditable="true"></div>

CSS

[contenteditable] {
	border: 1px #000 solid;
}

JavaScript

const observer = new MutationObserver( function( mutations ) {
	mutations.forEach( ( mutation ) => {
		console.log( mutation )
	} );
} );

observer.observe( document.querySelector( '[contenteditable]' ), {
	subtree: true,
	characterData: true
} );