I would like to find out where the web browser wrapped text in a given div
.
The motivation for this is a WYSIWYG editor that uses contenteditable
. Users write text in there, and depending on the width of the editable field, the font, and other factors, it wraps at certain locations. I would like to know where these occur.
I can only think of very hackish solutions (e.g., insert a span
around each character, loop over these spans, get their offsetTop
property, and make a note whenever it changes). Is there a better/standard way of doing this?