mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-04 11:54:10 +01:00
Paste plain text without quoting
This commit is contained in:
@@ -77,7 +77,7 @@ public class EditTextCompose extends FixedEditText {
|
||||
CharSequence text = item.getText();
|
||||
if (text == null)
|
||||
return false;
|
||||
html = "<div>" + HtmlHelper.formatPre(text.toString()) + "</div>";
|
||||
html = "<div>" + HtmlHelper.formatPre(text.toString(), false) + "</div>";
|
||||
}
|
||||
|
||||
Document document = HtmlHelper.sanitizeCompose(context, html, false);
|
||||
|
||||
@@ -1293,12 +1293,17 @@ public class HtmlHelper {
|
||||
}
|
||||
|
||||
static String formatPre(String text) {
|
||||
return formatPre(text, true);
|
||||
}
|
||||
|
||||
static String formatPre(String text, boolean quote) {
|
||||
int level = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String[] lines = text.split("\\r?\\n");
|
||||
for (String line : lines) {
|
||||
// Opening quotes
|
||||
// https://tools.ietf.org/html/rfc3676#section-4.5
|
||||
if (quote) {
|
||||
int tlevel = 0;
|
||||
while (line.startsWith(">")) {
|
||||
tlevel++;
|
||||
@@ -1318,6 +1323,7 @@ public class HtmlHelper {
|
||||
for (int i = 0; i < level - tlevel; i++)
|
||||
sb.append("</blockquote>");
|
||||
level = tlevel;
|
||||
}
|
||||
|
||||
// Tabs characters
|
||||
StringBuilder l = new StringBuilder();
|
||||
|
||||
Reference in New Issue
Block a user