wordpress-mobile / AztecEditor-Android

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

Advanced styling of headings #992

Closed planarvoid closed 1 year ago

planarvoid commented 1 year ago

Fix

In this PR I'm introducing advanced options for styling some elements. For example headings now can be sized and changed each one differently. Headings now support size and color.

Test

  1. Modify the AztecText style in MainActivity to use headingNFontSize or headingNFontColor where N stands for heading types between one and six
  2. Run the app
  3. Notice the heading styling

Review

@[USER_NAME]

Make sure strings will be translated:

planarvoid commented 1 year ago

you're right @khaykov . However, I've tested trunk and it's happening there as well so I don't think it's related to these changes.

I have no idea why the edit text isn't redrawn when the heading is added/removed. I've tried a few approaches and nothing redraws it so I've added a hacky fix which adds and removes a new line when a heading is applied/removed. It works well so let me know what you think!

khaykov commented 1 year ago

@planarvoid Got it! While fix definitely helps avoid some crazy situations, I think it is a bit too hacky, and I can't really be sure it will not lead to some weird behavior down the line :) I think it would be a good idea to have a dedicated effort on this one, since it looks like other elements apart from heading are also affected by it, as described in #931.

planarvoid commented 1 year ago

yeah, it just ignores the updated line height for all the elements. It's just much more prominent for the headings because the line height there is much bigger. I'll revert the change and we can leave it for a separate fix 👍