I have a simple content editable div with certain width and height now, I want to fire an event when cursor reaches end of the content editable div and also the end of the line.
Use Case: Something like google docs when user reaches the end of the page it inserts the new page
When cursor reaches the end of the div while typing, I should be able to fires and event which will trigger some dom changes or display a notice that you can not type more chars in it.
We don't want a limit on number of chars or words in the div instead it should (I guess) be based on cursor offset from the bottom or right of the div(but how?).
Any hint in this direction would be good enough. Here is basic html http://jsfiddle.net/illumine/jfknz/
<div id="editor" contenteditable='true'>
If user types in this area it should fire an event if the end of line reached while typing i.e. when cursor switches the line.
<br/>
Also an event should fire when cursor has reached end of the div. i.e. when content overflows the div.
</div>