Comments (2)
You need to retrieve the selected text as a Spanned text and then convert it to HTML. The getSelectionStart() and getSelectionEnd() indicate the selection in the text as you see it in the editor and that's in Spanned format not in HTML.
So something like this:
int selStart = mRTMessageField.getSelectionStart();
int selEnd = mRTMessageField.getSelectionEnd();
Spannable text = (Spannable) mRTMessageField.getText().subSequence(selStart, selEnd);
RTHtml<RTImage, RTAudio, RTVideo> rtHtml = new ConverterSpannedToHtml().convert(text, RTFormat.HTML);
String thatsMySelectionInHTML = rtHtml.getText()
from android-rteditor.
You're welcome by the way...
from android-rteditor.
Related Issues (20)
- Bug: getText(RTFormat.HTML) puts multiple "\n" together with <br/> , instead of just having <br/>
- Bug: entering text in new empty line of list causes previous one to take the text and another
- Trouble Applying the 1.6.7 version HOT 3
- How to add a blockquote an horizontal line?
- Photo Capture is not working in the latest version of this library (1.6.7 of RTEditor)
- Android 8.0 insert text crash
- Fatal Exception: java.lang.IllegalStateException: The RTMediaFactory is null. Please make sure to register the editor at the RTManager before using it. HOT 2
- Can we have support for Fonts? HOT 1
- android.view.InflateException while using RTEditor HOT 1
- No subscribers registered for event class com.onegravity.rteditor.media.choose.MediaEvent when picking an image
- 为啥如此设置字体恢复不了 HOT 2
- Installation Error HOT 5
- link error
- Heading1 and heading2 formatting required HOT 2
- is this support kotlin? HOT 1
- [BUG] numbering append with <ol> when the last item deleted HOT 2
- It is possible to add emoji and file uploading
- Insta bug 11.3.0 is not working after integrated rteditor:1.7.6" HOT 2
- [BUG] Indentation left does not work any more in latest version
- [BUG] Caused by: android.view.InflateException: Binary XML file line #36 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-rteditor.