wordpress-mobile / AztecEditor-Android

A reusable native Android rich text editor component.
Mozilla Public License 2.0
698 stars 115 forks source link

Format text then remove format removes color style #914

Open cameronvoell opened 4 years ago

cameronvoell commented 4 years ago

Expected

Toggling a format on and off should not change the color attribute of text in the visual editor or html editor.

Observed

Toggling a format on and off removes text color alterations in the visual editor. In some cases the color attribute still exists in the html, toggling html mode on and off brings the color back in the visual editor. In other cases when toggling a format, the color is removed from the html.

Video:

color-disappears

Reproduced

Case 1 - Toggling format does not change html, switching html mode then back to visual brings color back:

  1. Highlight some text that has a color attribute but is NOT italicized
  2. Click italic button to italicize
  3. Click italic button again and notice italics are gone, and the color is not showing either
  4. Click HTML mode, notice the color attribute still exists for this element
  5. Return to visual mode and notice the color has returned

Case 2- Toggling format removes color attibute from html, toggling to html mode and back to visual does not bring the color back.

  1. Highlight some text that has a color attribute AND IS italicized (not in a list)
  2. Click italic button and notice italics are gone, and the color is not showing either
  3. Click HTML mode, notice the color attribute is gone
  4. Return to visual mode and verify that color does not return

Tested

[Samsung Galaxy Tab S3] on [Android 9] with [AztecEditor-Android v1.3.43]

arctouch-felipevaladares commented 4 years ago

i found the source of the bug, InlineFormatter L:232, for some reason every time that we remove some format its also removing all the ForegroundColorSpan, i'll remove this on my PR for bg color https://github.com/wordpress-mobile/AztecEditor-Android/pull/911