Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set minHeight based on fontSize or style. #14344

Merged
merged 2 commits into from
Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/editor/src/components/rich-text/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ export class RichText extends Component {

this.lastEventCount = undefined; // force a refresh on the native side
}
let minHeight = 0;
let minHeight = styles[ 'editor-rich-text' ].minHeight;
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a check for the validity of style and style.minHeight right after this line. Can we consolidate them somehow?

Copy link
Contributor

Choose a reason for hiding this comment

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

let minHeight = styles[ 'editor-rich-text' ].minHeight;
if ( style && style.minHeight ) {
	minHeight = style.minHeight;
}

style comes from props. This seems to be a good way to let the user of RichText modify the default minHeight.

Copy link
Contributor

@etoledom etoledom Mar 8, 2019

Choose a reason for hiding this comment

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

@hypest did you mean something else by consolidate them?
We could set minHeight at once but the code might be less readable.

Something like:

const minHeight = (style && style.minHeight) || styles[ 'editor-rich-text' ].minHeight;

What do you think @marecar3 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@etoledom looking good to me :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Late to reply but, want to verify that yeah, that looks good to me too!

if ( style && style.minHeight ) {
minHeight = style.minHeight;
}
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/rich-text/style.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
.editor-rich-text {
font-family: $default-regular-font;
text-decoration-color: $gray;
min-height: $min-height-paragraph;
}