mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-23 06:31:17 +00:00
Switch markdown/formatted text
This commit is contained in:
parent
6f759b28a8
commit
4dc5e6ab7d
1 changed files with 9 additions and 3 deletions
|
@ -2348,7 +2348,10 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
private void onMenuMarkdown() {
|
private void onMenuMarkdown() {
|
||||||
markdown = !markdown;
|
markdown = !markdown;
|
||||||
onAction(R.id.menu_save, "Markdown");
|
Bundle args = new Bundle();
|
||||||
|
args.putBoolean("markdown", true);
|
||||||
|
args.putBoolean("show", true);
|
||||||
|
onAction(R.id.menu_save, args, "Markdown");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCompact(boolean compact) {
|
private void setCompact(boolean compact) {
|
||||||
|
@ -6716,7 +6719,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
boolean dirty = false;
|
boolean dirty = false;
|
||||||
String body;
|
String body;
|
||||||
if (markdown) {
|
if (markdown ^ extras.getBoolean("markdown")) {
|
||||||
MutableDataSet options = new MutableDataSet();
|
MutableDataSet options = new MutableDataSet();
|
||||||
options.set(Parser.EXTENSIONS, Arrays.asList(
|
options.set(Parser.EXTENSIONS, Arrays.asList(
|
||||||
TablesExtension.create(),
|
TablesExtension.create(),
|
||||||
|
@ -6726,8 +6729,11 @@ public class FragmentCompose extends FragmentBase {
|
||||||
String html = renderer.render(parser.parse(spanned.toString()));
|
String html = renderer.render(parser.parse(spanned.toString()));
|
||||||
|
|
||||||
Document doc = JsoupEx.parse(html);
|
Document doc = JsoupEx.parse(html);
|
||||||
doc.body().attr("markdown", "true");
|
doc.body().attr("markdown", Boolean.toString(markdown));
|
||||||
body = doc.html();
|
body = doc.html();
|
||||||
|
|
||||||
|
if (markdown != extras.getBoolean("markdown"))
|
||||||
|
dirty = true;
|
||||||
} else
|
} else
|
||||||
body = HtmlHelper.toHtml(spanned, context);
|
body = HtmlHelper.toHtml(spanned, context);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue