Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In iOS How to get the click on the location of the information and get the selected text string? #92

Open
dengzhucai opened this issue Nov 24, 2016 · 1 comment

Comments

@dengzhucai
Copy link

Hi @danielweck ,
I want to click on the location of the information and the content of the selected text, such as:[NSString stringWithFormat:@"document.elementFromPoint(%f, %f).src", touch.x, touch.y];
window.getSelection().getRangeAt(0).toString() ;

I have a getElementFromPoint method found in the file(readium-shared-js.js) But I don't know how to use.
Thanks and waiting on your response.

@dengzhucai dengzhucai changed the title In iOS how to click on the location and text strings? In iOS How to get the click on the location of the information and get the selected text string? Nov 24, 2016
@danielweck
Copy link
Member

Using Javascript code, you could implement a small routine that creates a text range selection in the DOM based on the location of the user's click / touch.
Then, you could exploit the DOM selection created by the webview, simply by using the existing "highlights" plugin: https://github.com/readium/readium-shared-js/tree/develop/plugins/highlights

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants