1

I am developing an epub renderer app for iOS with highlights included as one of its features. I have the algorithm for highlight creation (based on text selections made by user), removal and tap-on-highlight detection that works very well. But to get even better behaviour I would like to restrict text selection on plain text selecting.

In other words, on iOS7 & iOS8 devices I can create selection blocks around html nodes, like this:

enter image description here

As you can see on the pic above, the text selection box goes until header's margins and it is not bound to the text only. I would like that UIWebView automatically transforms that kind of selections to "around-text-only" selection, like this:

enter image description here

The reason I need this restriction is because in the first case some adjacent html nodes can get included under selection (like empty paragraphs, etc), while in the second case I have plain text selection that I can easily handle with my algorithm.

Once again, I don't want to disable text selection, I just want to bind blue selection box to the plain text only.

So can I do something to get that transformation in UIWebView? Use some javascript method perhaps?

  • 2
    Possible duplicate of [Disabling user selection in UIWebView](http://stackoverflow.com/questions/5995210/disabling-user-selection-in-uiwebview) – JAL Nov 25 '15 at 02:20
  • How can it be a duplicate? I don't want to disable text selection completely. I just want to bind the selection box on text only. Look at the screenshots. – SvenMajeric Nov 25 '15 at 08:40

0 Answers0