mirror of https://github.com/M66B/FairEmail.git
Keep original initial draft
This commit is contained in:
parent
2ee8098281
commit
7afecc746b
|
@ -3707,6 +3707,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
args.putString("cc", etCc.getText().toString().trim());
|
args.putString("cc", etCc.getText().toString().trim());
|
||||||
args.putString("bcc", etBcc.getText().toString().trim());
|
args.putString("bcc", etBcc.getText().toString().trim());
|
||||||
args.putString("subject", etSubject.getText().toString().trim());
|
args.putString("subject", etSubject.getText().toString().trim());
|
||||||
|
args.putCharSequence("loaded", (Spanned) etBody.getTag());
|
||||||
args.putCharSequence("spanned", etBody.getText());
|
args.putCharSequence("spanned", etBody.getText());
|
||||||
args.putBoolean("signature", cbSignature.isChecked());
|
args.putBoolean("signature", cbSignature.isChecked());
|
||||||
args.putBoolean("empty", isEmpty());
|
args.putBoolean("empty", isEmpty());
|
||||||
|
@ -5029,6 +5030,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
String cc = args.getString("cc");
|
String cc = args.getString("cc");
|
||||||
String bcc = args.getString("bcc");
|
String bcc = args.getString("bcc");
|
||||||
String subject = args.getString("subject");
|
String subject = args.getString("subject");
|
||||||
|
Spanned loaded = (Spanned) args.getCharSequence("loaded");
|
||||||
Spanned spanned = (Spanned) args.getCharSequence("spanned");
|
Spanned spanned = (Spanned) args.getCharSequence("spanned");
|
||||||
boolean signature = args.getBoolean("signature");
|
boolean signature = args.getBoolean("signature");
|
||||||
boolean empty = args.getBoolean("empty");
|
boolean empty = args.getBoolean("empty");
|
||||||
|
@ -5202,12 +5204,22 @@ public class FragmentCompose extends FragmentBase {
|
||||||
Elements ref = doc.select("div[fairemail=reference]");
|
Elements ref = doc.select("div[fairemail=reference]");
|
||||||
ref.remove();
|
ref.remove();
|
||||||
|
|
||||||
Document b;
|
if (extras != null && extras.containsKey("html"))
|
||||||
if (body == null)
|
dirty = true;
|
||||||
b = Document.createShell("");
|
|
||||||
else
|
if (!dirty)
|
||||||
b = HtmlHelper.sanitizeCompose(context, body, true);
|
if (loaded == null) {
|
||||||
HtmlHelper.clearAnnotations(b);
|
Document b = HtmlHelper.sanitizeCompose(context, body, true);
|
||||||
|
HtmlHelper.clearAnnotations(b);
|
||||||
|
if (!Objects.equals(b.body().html(), doc.body().html()))
|
||||||
|
dirty = true;
|
||||||
|
} else {
|
||||||
|
// Was not dirty before
|
||||||
|
String hloaded = HtmlHelper.toHtml(loaded, context);
|
||||||
|
String hspanned = HtmlHelper.toHtml(spanned, context);
|
||||||
|
if (!Objects.equals(hloaded, hspanned))
|
||||||
|
dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (draft.revision == null) {
|
if (draft.revision == null) {
|
||||||
draft.revision = 1;
|
draft.revision = 1;
|
||||||
|
@ -5215,10 +5227,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
int revision = draft.revision; // Save for undo/redo
|
int revision = draft.revision; // Save for undo/redo
|
||||||
if (dirty ||
|
if (dirty) {
|
||||||
TextUtils.isEmpty(body) ||
|
|
||||||
!b.body().html().equals(doc.body().html()) ||
|
|
||||||
(extras != null && extras.containsKey("html"))) {
|
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
||||||
// Get saved body
|
// Get saved body
|
||||||
|
@ -5637,6 +5646,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
db.endTransaction();
|
db.endTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
args.putBoolean("dirty", dirty);
|
||||||
if (dirty)
|
if (dirty)
|
||||||
ServiceSynchronize.eval(context, "compose/action");
|
ServiceSynchronize.eval(context, "compose/action");
|
||||||
|
|
||||||
|
@ -5676,6 +5686,10 @@ public class FragmentCompose extends FragmentBase {
|
||||||
if (bccPos >= 0 && bccPos <= etBcc.getText().length())
|
if (bccPos >= 0 && bccPos <= etBcc.getText().length())
|
||||||
etBcc.setSelection(bccPos);
|
etBcc.setSelection(bccPos);
|
||||||
|
|
||||||
|
boolean dirty = args.getBoolean("dirty");
|
||||||
|
if (dirty)
|
||||||
|
etBody.setTag(null);
|
||||||
|
|
||||||
Bundle extras = args.getBundle("extras");
|
Bundle extras = args.getBundle("extras");
|
||||||
boolean show = extras.getBoolean("show");
|
boolean show = extras.getBoolean("show");
|
||||||
if (show)
|
if (show)
|
||||||
|
@ -5954,6 +5968,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
@Override
|
@Override
|
||||||
protected void onExecuted(Bundle args, Spanned[] text) {
|
protected void onExecuted(Bundle args, Spanned[] text) {
|
||||||
etBody.setText(text[0]);
|
etBody.setText(text[0]);
|
||||||
|
etBody.setTag(text[0]);
|
||||||
|
|
||||||
if (state != State.LOADED) {
|
if (state != State.LOADED) {
|
||||||
int pos = getAutoPos(0, etBody.length());
|
int pos = getAutoPos(0, etBody.length());
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
|
|
Loading…
Reference in New Issue