defmethodinc / just-not-sorry

Chrome extension that warns you when you write emails using words which undermine your message
https://justnotsorry.com/
Other
243 stars 37 forks source link

Fix highlighting issue edge cases #124

Closed sbrudz closed 3 years ago

sbrudz commented 3 years ago

As reported in issue #117, the highlighting was not appearing in certain situations. For example, if a warning phrase was on a line by itself. This issue is due to the way the match utility finds the matches.

For example, when the email DOM text looks like this:

<div>
  sorry checking
  <div>
    sorry
  </div>
</div>

Both instances "sorry" should be highlighted, but only the first one was being highlighted. I tracked it down to this line in util.js. When we call el.textContent, the resulting string is "sorry checkingsorry" and the regular expression match for sorry, \b(sorry)\b doesn't pick up the second one.

I tried several approaches to fixing this issue, but none of them worked.

In the end, I realized that a simple fix would be to loosen the regular expressions so that word boundaries aren't required. This seems to work well. The one case where I kept a word boundary in place was for "just", since I didn't want "justified" to be partially highlighted.

I also added "we believe" and "we feel" to the warning list, per Tami's request.

Fixes #117

sbrudz commented 3 years ago

Packaged version of the extension to help with testing:

just-not-sorry-chrome.zip

tamireiss commented 3 years ago

Looking good! -Tami @tamireiss / tamireiss.com

On Tue, May 18, 2021 at 3:13 PM Steve Brudz @.***> wrote:

Packaged version of the extension to help with testing:

just-not-sorry-chrome.zip https://github.com/defmethodinc/just-not-sorry/files/6503712/just-not-sorry-chrome.zip

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/defmethodinc/just-not-sorry/pull/124#issuecomment-843462474, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMWI53NIIS5K3FTK2EI2ADTOK357ANCNFSM45DDOYBQ .

github-actions[bot] commented 3 years ago

:tada: This PR is included in version 2.0.0-beta.8 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] commented 2 years ago

:tada: This PR is included in version 2.1.0-beta.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] commented 2 years ago

:tada: This PR is included in version 2.1.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: