javascript - How to determine caret position in Etherpad immediately after keypress? -
i'm working on etherpad-lite plugin providing special autocomplete while writing. i'm trying update list of autocomplete items user writes. problem caret position in aceeditevent's context.rep.selstart , context.rep.selend updated in first idleworktimer event after keypress, has huge latency purpose.
the events in aceeditevent happen following:
- handlekeyevent - comes (for keydown guess), content.rep has selection before keystroke
- handlekeyevent - comes (for keypress guess), content.rep has selection before keystroke
- handlekeyevent - comes (for keyup guess), content.rep has selection before keystroke
- idleworktimer - comes 1s latency, content.rep has selection after keystroke
so how new caret position without latency?
the answer here: https://github.com/ether/etherpad-lite/issues/2015
basically problem still unsolved. workaround it's possible use settimeout after event have right caret position.
Comments
Post a Comment