mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-07 01:23:38 +02:00
Added detect HTML
This commit is contained in:
@@ -55,6 +55,7 @@ import androidx.core.view.inputmethod.InputConnectionCompat;
|
||||
import androidx.core.view.inputmethod.InputContentInfoCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.github.DetectHtml;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
@@ -487,7 +488,7 @@ public class EditTextCompose extends FixedEditText {
|
||||
String h = null;
|
||||
if (raw) {
|
||||
CharSequence text = item.getText();
|
||||
if (text != null && HtmlHelper.isHtml(text.toString()))
|
||||
if (text != null && DetectHtml.isHtml(text.toString()))
|
||||
h = text.toString();
|
||||
}
|
||||
if (h == null)
|
||||
|
||||
@@ -3829,12 +3829,6 @@ public class HtmlHelper {
|
||||
.remove("x-keep-line");
|
||||
}
|
||||
|
||||
static boolean isHtml(String text) {
|
||||
Pattern p = Pattern.compile(".*\\<[^>]+>.*", Pattern.DOTALL);
|
||||
boolean isHtml = p.matcher(text).matches();
|
||||
return isHtml;
|
||||
}
|
||||
|
||||
static Spanned fromHtml(@NonNull String html, Context context) {
|
||||
Document document = JsoupEx.parse(html);
|
||||
return fromDocument(context, document, null, null);
|
||||
|
||||
Reference in New Issue
Block a user