Check for pasting raw HTML

This commit is contained in:
M66B
2023-01-18 22:29:37 +01:00
parent 778849fb98
commit dc814cffb9
2 changed files with 16 additions and 3 deletions

View File

@@ -3829,6 +3829,12 @@ 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);