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 200ms ... see:

We also know when it has changed (like the API or the keyboard / On the mouse or on the original selection - on the action) - so much ... all the time :) AFAIK We do some tricks, so it does not burn your CPU, but it is still heavy. However, if we have done so, then this is the only possible way that this work is very well done.

Unfortunately, selection management is the world's strongest strongest worst task, it has broken into very old and new browsers, the file above has more than 75% LOCs in the above file, There are hacks and tricks. It is full madness.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -