How to correctly crop text in contenteditable div?

If you add the div contenteditable attribute to true then it allows you to embed html how correctly to add limit but rather to crop the text if the user entered more than the limit ?
July 12th 19 at 17:03
2 answers
July 12th 19 at 17:05
Listen to the event input/paste and change data.
July 12th 19 at 17:07
sorry here is the bigger question not how to catch the event, but as poudalyat text without breaking html...

Find more questions by tags HTMLJavaScript