I'm using a rich text editor called Quill which generates a contenteditable div like this:
<div class="ql-editor" data-gramm="false" contenteditable="true">
</div>
Of course, that div then contains HTML for whatever content is currently in the editor. The HTML is often nested.
Is there a slick way of easily determining if the text cursor (caret) is currently within a contenteditable div? If not, what's the best way to check if the text cursor is within a contenteditable div or a child node of a contenteditable div?
I'm using vanilla JavaScript.