File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -414,9 +414,13 @@ func draftContentHTML(content string) string {
414414 content = strings .ReplaceAll (content , "\r " , "\n " )
415415 lines := strings .Split (content , "\n " )
416416 for i , line := range lines {
417- lines [i ] = html .EscapeString (line )
417+ if line == "" {
418+ lines [i ] = "<div><br></div>"
419+ continue
420+ }
421+ lines [i ] = "<div>" + html .EscapeString (line ) + "</div>"
418422 }
419- return "<div>" + strings .Join (lines , "<br>" ) + "</div>"
423+ return strings .Join (lines , "" )
420424}
421425
422426func looksLikeDraftHTML (content string ) bool {
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ func TestDraftValuesFormatsPlainTextContent(t *testing.T) {
4444 To : []string {"chrissie@example.com" },
4545 })
4646
47- want := "<div>Hi Chrissie,<br>< br>Thanks & all the best.<br><br >Mike</div>"
47+ want := "<div>Hi Chrissie,</div><div>< br></div><div> Thanks & all the best.</div><div><br></div><div >Mike</div>"
4848 if got := values .Get ("message[content]" ); got != want {
4949 t .Fatalf ("content = %q, want %q" , got , want )
5050 }
You can’t perform that action at this time.
0 commit comments