Skip to content

Post Editor - Make heading style distinguishable from paragraph#10912

Merged
pinarol merged 15 commits intodevelopfrom
gutenberg/improve-heading-style
Feb 5, 2019
Merged

Post Editor - Make heading style distinguishable from paragraph#10912
pinarol merged 15 commits intodevelopfrom
gutenberg/improve-heading-style

Conversation

@pinarol
Copy link
Copy Markdown
Contributor

@pinarol pinarol commented Jan 29, 2019

Fixes wordpress-mobile/gutenberg-mobile#351

This PR updates the style of Heading block and makes it distinguishable from paragraph.

Aztec PR: wordpress-mobile/AztecEditor-iOS#1127
mobile-gutenberg PR: wordpress-mobile/gutenberg-mobile#525

aztec-bold

gutenberg-bold

To Test

Prerequisites

  • Remove pods folder and run rake dependencies
  • Clean Xcode build folder

Repeat Gutenberg Tests for both Aztec and Gutenberg editors

Additional Tests

  1. Dirty Flag:
    Open a post, select a Heading text and tap B button
    Tap close button
    Check if Alert sheet is popped up asking if you want to save or discard changes
    (For Aztec classes editor tapping B button also should activate the Update button on navigation bar)

  2. Saving
    Try Saving post after changing Bold attribute of some part of Header and paragraph blocks
    Close the post
    Reopen the post
    Verify that changes are saved

Update release notes:

  • If there are user facing changes, I have added an item to RELEASE-NOTES.txt.

@pinarol pinarol changed the title [NOT READY] Gutenberg - Make heading style distinguishable from paragraph Post Editor - Make heading style distinguishable from paragraph Jan 30, 2019
@pinarol
Copy link
Copy Markdown
Contributor Author

pinarol commented Jan 30, 2019

Hey @iamthomasbishop 👋 You can request a new build from this PR's branch and start reviewing the style

@iamthomasbishop
Copy link
Copy Markdown

Changes look nice! I think the text-shadow might be a tiny bit too strong, but it at least is better than no visual difference. Are we using straight css to apply this? If so, what are the values?

One other thing I noticed: When I try go to HTML Mode and change a header, from an h2 to h5 by editing the markup, when I switch back to Visual Mode, that change isn't visualized.

@pinarol
Copy link
Copy Markdown
Contributor Author

pinarol commented Jan 31, 2019

Hey @iamthomasbishop thanks for the feedback.

Are we using straight css to apply this? If so, what are the values?

We aren't using css, We are doing this on native side with NSShadow, it has basically 3 parameters:

shadow-x-offset: Horizontal growing amount for shadow, this is determined with the if-else I am putting below
shadow-y-offset: Vertical growing amount for shadow, this is set to 0 in our case.
shadow-blur-radius: This is also 0 for our case because we don't want blur in order to mimic the extra boldness.

here is how shadow-x-offset is calculated with respect to the font size:

           if fontSize >= 22 {
                return 0.82
            } else if fontSize >= 20 && fontSize < 22 {
                return 0.78
            } else if fontSize >= 18 && fontSize < 20 {
                return 0.75
            } else if fontSize >= 16 && fontSize < 18 {
                return 0.72
            } else {
                return 0.7
            }

We can play with these values to find the best result.

One other thing I noticed: When I try go to HTML Mode and change a header, from an h2 to h5 by editing the markup, when I switch back to Visual Mode, that change isn't visualized.

I guess you did this on Gutenberg editor right? If so, it is because we don't support h5 in GB, if you were in debug mode you'd see a validation error about it. I tried with one of the supported values and worked fine:

gutenberg-bold-switch

@iamthomasbishop
Copy link
Copy Markdown

iamthomasbishop commented Jan 31, 2019

here is how shadow-x-offset is calculated with respect to the font size:

Ok, thanks for the explanation! Does that code you shared above only apply to headings, or any text with those fontSizes?

I do think we could pull back on the shadow slightly (~.1 less), but what we have now isn't terrible. Maybe we could try:

if fontSize >= 22 {
    return 0.72
} else if fontSize >= 20 && fontSize < 22 {
    return 0.68
} else if fontSize >= 18 && fontSize < 20 {
    return 0.65
} else if fontSize >= 16 && fontSize < 18 {
    return 0.62
} else {
    return 0.6
}

I guess you did this on Gutenberg editor right? If so, it is because we don't support h5 in GB

That's correct. I just found it a little odd – but something we can address separately maybe.

@pinarol
Copy link
Copy Markdown
Contributor Author

pinarol commented Jan 31, 2019

Does that code you shared above only apply to headings, or any text with those fontSizes?

Only headings. We don't use shadow effect at any other type of text, other type of texts won't get effected.

I'll update the PR with those values you suggested and let you know @iamthomasbishop

@pinarol
Copy link
Copy Markdown
Contributor Author

pinarol commented Jan 31, 2019

Hey @iamthomasbishop 👋 I've updated the values, this is ready to give another try.

Copy link
Copy Markdown
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as advertised!

@pinarol pinarol merged commit 3c6a73d into develop Feb 5, 2019
@pinarol pinarol deleted the gutenberg/improve-heading-style branch February 5, 2019 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Aztec Gutenberg Editing and display of Gutenberg blocks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make heading styling distinguishable from paragraph

3 participants