Skip to content

[Feature] Option to strip HTML emails of tags #6

@snipsnipsnip

Description

@snipsnipsnip

Add a toggle to let users edit an HTML email as if it were a plain text email.

Why complicate the situation? I think it's convenient to be able to switch them from the toolbar rather than having to tweak settings for each email.

In principle, Ghostbird is just a pipe between Thunderbird and the text editor, and so doesn't mess with the supplied text. But sometimes we have to preprocess the text before and after editing to show the text as the user intended.

The required processing differs depending on:

  • User preference (whether they want to edit as plain text always or HTML as is)
  • Composition email format (Thunderbird composes each email as either plain text or HTML)
  • Direction (reading from the compose window or writing into it)

As of alpha version, current behavior can be described as it assumes Thunderbird's composition email format always matches the user preference.

This preprocessing will be a bit more complex in #8 and #12.

  • When reading from the compose window
Email format→
User preference↓
Plain text HTML
Plain text Read body.textContent as is Read body.innerHTML and strip tags off*
HTML Read body.textContent as is Read body.innerHTML as is

* Thunderbird provides an API to do this, so we should try it first. Or maybe it's equivalent to do getComposeDetails() and get the plainTextBody from it.

  • When writing back into the compose window
Email format→
User preference↓
Plain text HTML
Plain text Write body.textContent as is Write body.textContent
or maybe wrap paragraphs as <p> tags and write to body.innerHTML
HTML Write body.textContent as is Write body.innerHTML as is

I hope we won’t have to parse HTML, but we need to experiment to see how much broken HTML Thunderbird can tolerate.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

🚧 WIP

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions