If I want to know when an editable field (say, an input text field or a contenteditable
div), I know that I can use the keyup
event.
However, I can only see what the new text is, and what the text was prior to the edit, but I would like to get some additional information about the edit.
For example, one case where this would be ambiguous would be if the input text was originally a and the new text was aa. Then:
- It could be the case that the user put the cursor before the a, and then typed another a.
- It could also be that the user put the cursor after the a, and then typed another a.
- It could even be that the user highlighted the a, then hit Ctrl+V (with aa in the clipboard).
I would like to be able to distinguish all the cases. For example, if I could get information of the form "insert a
at position 0
" or "delete range 0-1
while inserting aa
in its place" it would be perfect for my purposes.
Is it possible to get this kind of information?