mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 22:21:18 +00:00
Disable autolink for composer
This commit is contained in:
parent
12f0b169a6
commit
44dd58d0d1
5 changed files with 61 additions and 59 deletions
|
@ -139,7 +139,7 @@ public class ActivityEML extends ActivityBase {
|
|||
|
||||
String html = result.parts.getHtml(context);
|
||||
if (html != null)
|
||||
result.body = HtmlHelper.fromHtml(HtmlHelper.sanitize(context, html, false));
|
||||
result.body = HtmlHelper.fromHtml(HtmlHelper.sanitize(context, html, false, false));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1449,7 +1449,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
return document.html();
|
||||
} else {
|
||||
// Cleanup message
|
||||
String html = HtmlHelper.sanitize(context, body, show_images);
|
||||
String html = HtmlHelper.sanitize(context, body, show_images, true);
|
||||
|
||||
// Collapse quotes
|
||||
if (!show_quotes) {
|
||||
|
|
|
@ -68,7 +68,7 @@ public class EditTextCompose extends AppCompatEditText {
|
|||
ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
|
||||
|
||||
String html = item.coerceToHtmlText(context);
|
||||
html = HtmlHelper.sanitize(context, html, false);
|
||||
html = HtmlHelper.sanitize(context, html, false, false);
|
||||
Spanned paste = HtmlHelper.fromHtml(html);
|
||||
|
||||
int start = getSelectionStart();
|
||||
|
|
|
@ -781,7 +781,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
String text = HtmlHelper.getText(ref);
|
||||
html = "<p>" + text.replaceAll("\\r?\\n", "<br>") + "</p>";
|
||||
} else
|
||||
html = HtmlHelper.sanitize(context, ref, true);
|
||||
html = HtmlHelper.sanitize(context, ref, true, false);
|
||||
refFile.delete();
|
||||
|
||||
return body + html;
|
||||
|
@ -2235,7 +2235,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
data.draft.subject = args.getString("subject", "");
|
||||
body = args.getString("body", "");
|
||||
if (!TextUtils.isEmpty(body))
|
||||
body = HtmlHelper.sanitize(context, body, false);
|
||||
body = HtmlHelper.sanitize(context, body, false, false);
|
||||
|
||||
if (answer > 0) {
|
||||
EntityAnswer a = db.answer().getAnswer(answer);
|
||||
|
@ -2309,7 +2309,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
data.draft.subject = ref.subject;
|
||||
if (ref.content) {
|
||||
String html = Helper.readText(ref.getFile(context));
|
||||
body = HtmlHelper.sanitize(context, html, true);
|
||||
body = HtmlHelper.sanitize(context, html, true, false);
|
||||
}
|
||||
} else if ("list".equals(action)) {
|
||||
data.draft.subject = ref.subject;
|
||||
|
@ -2596,7 +2596,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
if (data.draft.content) {
|
||||
File file = data.draft.getFile(context);
|
||||
String html = Helper.readText(file);
|
||||
html = HtmlHelper.sanitize(context, html, true);
|
||||
html = HtmlHelper.sanitize(context, html, true, false);
|
||||
Helper.writeText(file, html);
|
||||
} else {
|
||||
if (data.draft.uid == null)
|
||||
|
@ -3316,7 +3316,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
Spanned spannedRef = null;
|
||||
File refFile = draft.getRefFile(context);
|
||||
if (refFile.exists()) {
|
||||
String quote = HtmlHelper.sanitize(context, Helper.readText(refFile), show_images);
|
||||
String quote = HtmlHelper.sanitize(context, Helper.readText(refFile), show_images, false);
|
||||
Spanned spannedQuote = HtmlHelper.fromHtml(quote,
|
||||
new Html.ImageGetter() {
|
||||
@Override
|
||||
|
|
|
@ -80,9 +80,9 @@ public class HtmlHelper {
|
|||
private static final List<String> tails = Collections.unmodifiableList(Arrays.asList(
|
||||
"h1", "h2", "h3", "h4", "h5", "h6", "p", "ol", "ul", "li"));
|
||||
|
||||
static String sanitize(Context context, String html, boolean show_images) {
|
||||
static String sanitize(Context context, String html, boolean show_images, boolean autolink) {
|
||||
try {
|
||||
return _sanitize(context, html, show_images);
|
||||
return _sanitize(context, html, show_images, autolink);
|
||||
} catch (Throwable ex) {
|
||||
// OutOfMemoryError
|
||||
Log.e(ex);
|
||||
|
@ -90,7 +90,7 @@ public class HtmlHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private static String _sanitize(Context context, String html, boolean show_images) {
|
||||
private static String _sanitize(Context context, String html, boolean show_images, boolean autolink) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean text_color = prefs.getBoolean("text_color", true);
|
||||
boolean display_hidden = prefs.getBoolean("display_hidden", false);
|
||||
|
@ -450,6 +450,7 @@ public class HtmlHelper {
|
|||
}
|
||||
|
||||
// Autolink
|
||||
if (autolink) {
|
||||
final Pattern pattern = Pattern.compile(
|
||||
PatternsCompat.AUTOLINK_EMAIL_ADDRESS.pattern() + "|" +
|
||||
PatternsCompat.AUTOLINK_WEB_URL.pattern());
|
||||
|
@ -513,6 +514,7 @@ public class HtmlHelper {
|
|||
public void tail(Node node, int depth) {
|
||||
}
|
||||
}, document);
|
||||
}
|
||||
|
||||
// Selective new lines
|
||||
for (Element div : document.select("div"))
|
||||
|
|
Loading…
Reference in a new issue