Closed ubarua123 closed 5 years ago
Also, is it possible to get a "text only" version after the user has entered or do I have to use an html parser like jsoup? Reason being, after the user has typed, I may want to integrate a grammar checker. But that tool will not understand HTML. So it'll need a text only version output. Sorry for so many questions!
Your questions are highly welcome.
First question: Fonts The according commands are SetFontNameCommand and SetFontNameWithPreviewCommand. Both use FontNameUtils that loads via SystemFontsParser all fonts available on system. (SystemFontsParser is a private field in FontNameUtils, my bad, sorry.) So you can either extend one of the two commands and use that one, or pass them a class derived from FontNameUtils. In both ways you should be able to customize the displayed font families. Does that help you?
Second question: Plain text Right, parsing the html with jsoup is also what i do for getting the plain text. Do you think i should provide a method getHtmlAsPlainText() or something like that to make it more handy for you?
Feel free to give me a pull request when you're done with your grammar checker, i'd love to integrate it into RichTextEditor.
Abouthe grammar checker, yeah I'll first do some research and see which ones fit well then I'll get in touch with you. :)
public class CustomizedSetFontNameWithPreviewCommand extends SetFontNameWithPreviewCommand {
@NotNull
@Override
public List<CharSequence> initValuesDisplayTexts() {
List<CharSequence> systemFonts = super.initValuesDisplayTexts();
// customize font list here
List<CharSequence> yourFonts = new ArrayList<>(systemFonts);
return yourFonts;
}
}
But i saw that by far not all command classes were overridable (Kotlin makes classes final by default). I changed that now and will be part of the upcoming 2.0.9 release. If there are any issues calling the Kotlin code, e.g. private fields, final classes, ..., let me know, then i change that for you.
Grammar checker: As RichTextEditor is using JavaScript under the hood (see rich_text_editor.js), may using a JavaScript grammar / spell checker already fits your needs.
Can I remove some of the font family options? Or where can I find that list? For a font it says "Coming soon" . I would like to remove that. Is it possible?