Small improvement

pull/178/head
M66B 5 years ago
parent aedd1d80c3
commit 430b1ca023

@ -75,7 +75,7 @@ public class EditTextCompose extends FixedEditText {
CharSequence text = item.getText(); CharSequence text = item.getText();
if (text == null) if (text == null)
return false; return false;
html = "<div plain=\"true\">" + HtmlHelper.formatPre(text.toString()) + "</div>"; html = "<div x-plain=\"true\">" + HtmlHelper.formatPre(text.toString()) + "</div>";
} }
Document document = HtmlHelper.sanitizeCompose(context, html, false); Document document = HtmlHelper.sanitizeCompose(context, html, false);

@ -5274,7 +5274,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
// Write decrypted body // Write decrypted body
String text = Helper.readText(plain); String text = Helper.readText(plain);
String html = "<div plain=\"true\">" + HtmlHelper.formatPre(text) + "</div>"; String html = "<div x-plain=\"true\">" + HtmlHelper.formatPre(text) + "</div>";
Helper.writeText(message.getFile(context), html); Helper.writeText(message.getFile(context), html);
db.message().setMessageStored(message.id, new Date().getTime()); db.message().setMessageStored(message.id, new Date().getTime());
db.message().setMessageFts(message.id, false); db.message().setMessageFts(message.id, false);

@ -446,7 +446,7 @@ public class HtmlHelper {
.addAttributes(":all", "class") .addAttributes(":all", "class")
.addAttributes(":all", "style") .addAttributes(":all", "style")
.addAttributes("font", "size") .addAttributes("font", "size")
.addAttributes("div", "plain") .addAttributes("div", "x-plain")
.removeTags("col", "colgroup", "thead", "tbody") .removeTags("col", "colgroup", "thead", "tbody")
.removeAttributes("table", "width") .removeAttributes("table", "width")
.removeAttributes("td", "colspan", "rowspan", "width") .removeAttributes("td", "colspan", "rowspan", "width")
@ -732,7 +732,7 @@ public class HtmlHelper {
for (Element pre : document.select("pre")) { for (Element pre : document.select("pre")) {
pre.html(formatPre(pre.wholeText())); pre.html(formatPre(pre.wholeText()));
pre.tagName("div"); pre.tagName("div");
pre.attr("plain", "true"); pre.attr("x-plain", "true");
} }
// Code // Code
@ -1789,7 +1789,7 @@ public class HtmlHelper {
block.add((TextNode) node); block.add((TextNode) node);
} else if (node instanceof Element) { } else if (node instanceof Element) {
element = (Element) node; element = (Element) node;
if ("true".equals(element.attr("plain"))) if ("true".equals(element.attr("x-plain")))
plain++; plain++;
if (BLOCK_START.contains(element.tagName())) { if (BLOCK_START.contains(element.tagName())) {
normalizeText(block); normalizeText(block);
@ -1802,7 +1802,7 @@ public class HtmlHelper {
public void tail(Node node, int depth) { public void tail(Node node, int depth) {
if (node instanceof Element) { if (node instanceof Element) {
element = (Element) node; element = (Element) node;
if ("true".equals(element.attr("plain"))) if ("true".equals(element.attr("x-plain")))
plain--; plain--;
if (BLOCK_END.contains(element.tagName())) { if (BLOCK_END.contains(element.tagName())) {
normalizeText(block); normalizeText(block);

@ -1591,7 +1591,7 @@ public class MessageHelper {
if (part.isMimeType("text/plain")) { if (part.isMimeType("text/plain")) {
if ("flowed".equalsIgnoreCase(ct.getParameter("format"))) if ("flowed".equalsIgnoreCase(ct.getParameter("format")))
result = HtmlHelper.flow(result); result = HtmlHelper.flow(result);
result = "<div plain=\"true\">" + HtmlHelper.formatPre(result) + "</div>"; result = "<div x-plain=\"true\">" + HtmlHelper.formatPre(result) + "</div>";
} else if (part.isMimeType("text/html")) { } else if (part.isMimeType("text/html")) {
if (TextUtils.isEmpty(charset)) { if (TextUtils.isEmpty(charset)) {
// <meta charset="utf-8" /> // <meta charset="utf-8" />

Loading…
Cancel
Save