javascript - How to track caret/cursor in contenteditable? -
I want to track the movement of the carat / cursor in a satisfactory way. I'm not sure what is the best way to do this, though. I am currently listening for clicks, keydown, keyboards. (For things like keyboard arrow keys or ctrl-x, the fire does not fire too.) While the click works fine, the problem with the keydown is that the carat actually removed before running So, when I query the current document selection range, I get the old position and not the new one but if I rely on the key to get the updated status, it takes too long: like The key is pressed, the more carat moves, but the key is released in a arbitrary time later. Should this be possible because things like CKDiter are able to do any sign? It is good to read that people are talking about CK editor; I am one of its developers and I am not doing much work on selection, but I will try to help. Do I know that an internal selectionChange event will change when we change? ... ... at least once in every 20...