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
@@ -98,6 +98,24 @@ describe("answering a message written in the other format", () => {
|
||||
expect(d.html).toContain("hi");
|
||||
});
|
||||
|
||||
it("keeps the quoted message in both formats, so a switch can restore it", async () => {
|
||||
composeIn("text");
|
||||
const d = await draftFor(RICH, "reply");
|
||||
// The HTML quote is the original's markup, not the text one converted.
|
||||
expect(d.quoteHtml).toContain("<p>hi</p>");
|
||||
expect(d.quoteHtml).toContain("ihm-quote");
|
||||
expect(d.quoteText).toContain("Ann");
|
||||
expect(d.text.endsWith(d.quoteText)).toBe(true);
|
||||
});
|
||||
|
||||
it("quotes nothing on a message started from scratch", () => {
|
||||
composeIn("text");
|
||||
const key = useCompose.getState().open();
|
||||
const d = useCompose.getState().drafts.find((x) => x.key === key)!;
|
||||
expect(d.quoteHtml).toBe("");
|
||||
expect(d.quoteText).toBe("");
|
||||
});
|
||||
|
||||
it("makes no offer on a message started from scratch", () => {
|
||||
composeIn("text");
|
||||
const key = useCompose.getState().open();
|
||||
|
||||
Reference in new issue
Block a user