facebookarchive / draft-js

A React framework for building text editors.
https://draftjs.org/
MIT License
22.56k stars 2.64k forks source link

How to get the cursor position? #3174

Closed chenjiashrimp closed 1 year ago

chenjiashrimp commented 1 year ago

i want to insert something in the middle of the text and i need to get the cursor position, how to get it?

bsaptyadeep commented 1 year ago

document.write("Coordinate(X) = " + event.clientX + "
Coordinate(Y) = " + event.clientY) This is the code to write cursor position in javaScript

bsaptyadeep commented 1 year ago

@chenjiashrimp can I be assigned this issue

chenjiashrimp commented 1 year ago

@bsaptyadeep thank you very much

chenjiashrimp commented 1 year ago

i want to insert something in the middle of the text and i need to get the cursor position, how to get it?

editorState.getSelection().getAnchorOffset()