I load a HTML page into my UIWebView in my iPad project and the html contains a contenteditable div which allows users to enter text.
I am trying to figure out what event gets called when a user long presses on the UIWebView. The reason I am trying to figure this out is because, I want to get the current cursor position after the user has long pressed on the webview and moved the cursor to a position in the div.
I can get the current position of the cursor through javascript by doing this,
So basically, I would use the same piece of code as soon as the user moves the cursor (through long press) to get the current cursor position. However, I am not able to figure out which event is called after/when the user long presses and moves the cursor.
It would be great if someone could help me out with this.
I am trying to figure out what event gets called when a user long presses on the UIWebView. The reason I am trying to figure this out is because, I want to get the current cursor position after the user has long pressed on the webview and moved the cursor to a position in the div.
I can get the current position of the cursor through javascript by doing this,
Code:
var selection = window.getSelection();
var node = selection.focusNode; // currently focused node
var ran = selection.getRangeAt(0); // current cursor position
So basically, I would use the same piece of code as soon as the user moves the cursor (through long press) to get the current cursor position. However, I am not able to figure out which event is called after/when the user long presses and moves the cursor.
It would be great if someone could help me out with this.