How do you detect what line it is in wrapped text elements?
Arnav Bansal
Posted on August 7, 2019
I'm implementing a custom editor that uses rows of contenteditable
divs. I'm having trouble implementing the right behavior for the 'up' or 'down' key.
When the 'up' key is pressed, I need to detect whether the caret is on the first line of text, and move the caret to the div above. Likewise for the 'down' key and the last line of text.
Thanks!
💖 💪 🙅 🚩
Arnav Bansal
Posted on August 7, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
javascript How I Created Vanilla Calendar Pro — A Lightweight and Flexible JavaScript Calendar with TypeScript
November 28, 2024