Skip to content

Commit

Permalink
Trying to leave Gmail's "plusreply" links intact
Browse files Browse the repository at this point in the history
Gmail adds links with a 'gmail_plusreply' class when tagging someone on an email.
Trying to leave these intact. Otherwise, rendering deletes some of the attributes of these links (e.g. id)
causing Gmail to remove the new recipients (sometimes).
  • Loading branch information
Gal Falkon committed Nov 26, 2021
1 parent 3efea51 commit ab546b7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/common/mdh-html-to-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ MdhHtmlToText.prototype._preprocess = function() {
// to remain intact.
this.excludeTagBlocks('blockquote', true);

// Try to leave intact the links that Gmail adds when tagging someone on an email
this.preprocessInfo.html = this.preprocessInfo.html.replace(
/<a (class="gmail_plusreply"[^>]+)>([^<]*)<\/a>/ig,
'&lt;a $1&gt;$2&lt;\/a&gt;'
);

// Try to leave intact the line that Gmail adds that says:
// On such-a-date, such-a-person <email addy> wrote:
this.preprocessInfo.html = this.preprocessInfo.html.replace(
Expand Down

0 comments on commit ab546b7

Please sign in to comment.