How do I get position where text is dropped

Hey!
I’m trying to drag the text from outside the codemirror and dropping into editor. So I need to get the position of where I am dropping the text because on drop I have to modify the text and then put into the editor.

Means, I have an eventHadler (EditorView.domEventHandlers) which is listening the drop event, when text comes I’m modifying it and then putting it into the editor. So I need the position of drop line to add the modified text.

Thanks!

view.posAtCoords on the coordinates in the drop event should work.

Thanks, It’s working but when I open my editor and without clicking anywhere on editor if I drop text in it, it always drops it at the wrong line.

But if I click anywhere on the editor then it’s dropping at the right place.