BTAndroidWebViewSelection icon indicating copy to clipboard operation
BTAndroidWebViewSelection copied to clipboard

getting the html source from the selection

Open davidemora opened this issue 12 years ago • 7 comments

very good work with this library! Is there a way to get the html source of the highlighted text?

davidemora avatar Feb 18 '13 10:02 davidemora

I too dont understand how to get the highlighted text from html source? if you know please post the answer.

spdeepa avatar Mar 18 '13 10:03 spdeepa

The highlighted text is being passed in to the app in the javascript interface method selectionChanged(rangyRange, text, handleBounds, menuBounds); If you were going to change the way the selection works i.e. plain text vs html, etc. You would do that in the javascript.

btate avatar Mar 18 '13 14:03 btate

Thank you for your response. i am developing epub reader. In this user will select the text with the long press once the action complete. i need to highlight the selected text .i can get the text and rangyRange as 2/9/2:0,0/15/2:734 With the rangy value how can i keep selected text with the highlighten? Can you please help me?

spdeepa avatar Mar 19 '13 05:03 spdeepa

I'm not sure what you're asking.

btate avatar Mar 19 '13 13:03 btate

Let me explain in detail. I am developing epub reader which contains html to load in webview. When user long press the text in webview, i nee to hightlight the text where user press and it should ask the option to hightlight. Once user came back to particular point where user selected already it should highlight remains same. As now i can take the selected text and rangy value but i dont know how to hightlight once again when the user comes to particular page where he already highlighted.

spdeepa avatar Mar 20 '13 05:03 spdeepa

You'll have to add some javascript to highlight a given rangy range, then store the rangy range given by the selection process in a database. When the page loads, redo the highlighting and unhighlighting in the order it was originally done.

Or, you could take the html contents of the page after each highlighting action and overwrite your stored file with it.

btate avatar Mar 20 '13 13:03 btate

Thanks for your response.

     "When the page loads, redo the highlighting and unhighlighting in the order it was originally done."

I dont know how to proceed the above things in coding. Can you please help me?

spdeepa avatar Mar 21 '13 04:03 spdeepa