Skip to content

Commit bb432ca

Browse files
committed
fix: use innerText instead of textContent when reading email body
It works better in recent Thunderbird as it replaces `<br>`s with newlines
1 parent 9cee86b commit bb432ca

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/app-compose/body_editor.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export class BodyEditor {
77
) {}
88

99
getBody(isPlainText: boolean): string {
10-
return (isPlainText ? this.body.textContent : this.body.innerHTML) ?? ""
10+
return (isPlainText ? this.body.innerText : this.body.innerHTML) ?? ""
1111
}
1212

1313
applyEdit(body: string, isPlainText: boolean): void {

‎src/test/ghostbird.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describe("Ghostbird", () => {
55
it("should send initial text to server when started from toolbar", async ({ expect }) => {
66
const sut = makeGhostbird()
77
sut.startFromToolbar({ id: 42 })
8-
sut.composeBody.textContent = "hello"
8+
sut.composeBody.innerText = "hello"
99

1010
let sent = await sut.sendsToServer()
1111
await sut.closeSession()
@@ -22,7 +22,7 @@ describe("Ghostbird", () => {
2222
it("should apply text from server to the compose body", async ({ expect }) => {
2323
const sut = makeGhostbird()
2424
sut.startFromToolbar({ id: 42 })
25-
sut.composeBody.textContent = "hello"
25+
sut.composeBody.innerText = "hello"
2626

2727
await sut.sendsToServer()
2828
await sut.receives("hello, world")

0 commit comments

Comments
 (0)