Switching a reply between plain text and rich text converted whatever body the draft was showing. Going from plain text to rich, that meant the quoted message came back as the "> " text quote run through a converter -- the sender's formatting, images and links gone, even though the original markup was sitting on the draft untouched. Both forms of the quote are prepared when the reply opens, so keep them on the draft and re-attach the right one when the format changes. Only what the author typed above the quote is converted. Where the quote can't be found any more -- edited by hand, or a draft that quotes nothing -- the whole body is converted as before, which is what every non-reply draft does. No new strings. (cherry picked from commit 88f9e6c50a04f8ffc4702d1d1e3cffa6a93e7690)
This commit is contained in:
1 parent
996aa66ef0
commit
9ba2c6e290
5 files changed
+92
-4
No files matched your search
@@ -76,6 +76,14 @@ export interface Draft {
|
||||
/** Original identity signature HTML currently embedded, to replace on identity switch. */
|
||||
signatureHtml: string;
|
||||
replyMode: "reply" | "replyAll" | "forward" | null;
|
||||
/**
|
||||
* The quoted message as it was prepared in each format, kept so that
|
||||
* switching format re-attaches the original rather than a conversion of
|
||||
* whatever the other format flattened it into. Empty on a draft that quotes
|
||||
* nothing.
|
||||
*/
|
||||
quoteHtml: string;
|
||||
quoteText: string;
|
||||
/**
|
||||
* The format the message being answered was written in, when it is not the
|
||||
* one this draft opened in (#407). The composer offers the switch; answering
|
||||
@@ -152,6 +160,8 @@ function blankDraft(init: Partial<Draft> = {}): Draft {
|
||||
error: null,
|
||||
signatureHtml: "",
|
||||
replyMode: null,
|
||||
quoteHtml: "",
|
||||
quoteText: "",
|
||||
formatOffer: null,
|
||||
sendAt: null,
|
||||
...init,
|
||||
@@ -474,6 +484,8 @@ export const useCompose = create<ComposeState>((set, get) => ({
|
||||
relatedKeyword: mode === "forward" ? "$forwarded" : "$answered",
|
||||
signatureHtml: sigHtml,
|
||||
replyMode: mode,
|
||||
quoteHtml,
|
||||
quoteText: quoteTxt,
|
||||
formatOffer: origFormat === s.composeFormat ? null : origFormat,
|
||||
});
|
||||
set((st) => ({ drafts: [...st.drafts, d], activeKey: d.key }));
|
||||
|
||||
Reference in new issue
Block a user