Reputation: 519
Hello i'm trying to make a search system and it works like this:
So i'm having problems with the third step I can't find any method about highlighting or find anything on google for HTMLEditor.
So my question is, is it possible to highlight text in a HTMLEditor and if so how?
Upvotes: 0
Views: 1769
Reputation: 1108
If you don't mind using reflection, it can be done natively in Java code.
See my answer here: https://stackoverflow.com/a/49350328/8837882.
Upvotes: 0
Reputation: 159416
Possible Approach
There is a similar question for search & highlight functionality in WebView
:
Perhaps you could use an adjustment of that approach (internally the HTMLEditor is implemented as a WebView I believe, though I could be wrong).
You might be able to use some techniques for customizing the existing HTMLEditor to get UI controls for executing searches into the toolbar of the HTMLEditor.
Alternatives
Rather than using HTMLEditor
you could either use:
WebView
with ContentEditable.If it were me, I'd probably choose the Markdown editor approach if the editor was for a semi-technical audience or the third party JavaScript editor in WebView if the audience was non-technical and required a WYSIWYG HTML editor with a ribbon.
Upvotes: 2